When I execute the following function:
browser.driver.manage().window().setSize(1000, 1000);
The result is that my window size becomes 1000x1000 while the inner window/viewport size changes to 990x918. By inner window size, I am referring to the area of the window that displays content without considering borders or tabs. In this scenario, there are 5px borders on each side and additional 82px occupied by url and tab bars.
I aim to set the inner window size in a way that doesn't require accounting for specific machine configurations where extra toolbars might be present.
Is there a protractor command available for setting the size of the actual inner, content-filled part of the window?
Following the response below, I included the following code snippet in the onPrepare section of my conf file:
protractor.setViewportSize = function(width, height){
const JS_GET_PADDING = "return {"
+ "w: window.outerWidth - window.innerWidth,"
+ "h: window.outerHeight - window.innerHeight };";
browser.executeScript(JS_GET_PADDING).then(function(pad){
browser.manage().window().setSize(width + pad.w, height + pad.h);
});
};
In my test case, I utilize something like this:
protactor.setViewportSize(1440, 1000);