How to Minimize and Maximize the Browser using Selenium Java

asked 11 months ago

Minimize the browser:

driver.manage().window().minimize();

 

Till Selenium 3 there was no method to minimize the screen, we can use the setPosition method to minimize it.

Point p = driver.manage().window().getPosition();
Dimension d = driver.manage().window().getSize();
driver.manage().window().setPosition(new Point((d.getHeight()- p.getX()), (d.getWidth()-p.getY())));

 

Maximize the browser:

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

 

Categories