0 votes
in Selenium by
How to set browser window size in Selenium?

1 Answer

0 votes
by
The window size can be maximized, set or resized

To maximize the window

   driver.manage().window().maximize();

To set the window size

  Dimension d = new Dimension(400,600);

  driver.manage().window().setSize(d);

Alternatively,

The window size can be reset using JavaScriptExecutor

 ((JavascriptExecutor)driver).executeScript("window.resizeTo(1024, 768)");

Related questions

0 votes
asked Jan 30, 2020 in Selenium by Deepanshu Burreja
0 votes
asked Mar 31, 2021 in Selenium by sharadyadav1986
...