I\'m trying to create a cross-browser Python-Selenium
test script. So I need all results to be same no matter which webdriver
(Chrome
or <
Here's the Java version for @Florent B. answer :
int width = "500";
int height = "500";
//Remove the window from fullscreen (optional), if it s in fullscreen the outerHeight is not accurate
browser.manage().window().setSize(new Dimension(800,800));
JavascriptExecutor js= (JavascriptExecutor)browser;
String windowSize = js.executeScript("return (window.outerWidth - window.innerWidth + "+width+") + ',' + (window.outerHeight - window.innerHeight + "+height+"); ").toString();
//Get the values
width = Integer.parseInt(windowSize.split(",")[0]);
height = Integer.parseInt(windowSize.split(",")[1]);
//Set the window
browser.manage().window().setSize(new Dimension(width, height));