I need to resize the browser as 300x400 during executing the Selenium automated tests. How can I resize the browser window in Selenium WebDriver (aka, Selenium 2) with Java?
We can also use Chrome capability to resize the window.
ChromeOptions options = new ChromeOptions(); options.addArguments("window-size=800,480"); DesiredCapabilities cap = DesiredCapabilities.chrome(); cap.setCapability(ChromeOptions.CAPABILITY, options);