简体   繁体   中英

Not able to maximize browser after using the command “driver.manage().window().setPosition(new Point(0,-1000));” in Selenium

I used the following command to minimize chrome browser:

driver.manage().window().setPosition(new Point(0,-1000));

But later when I clicked on chrome browser in toolbar to maximize, its not maximizing.

Can anybody help on this one please, why its not working?

The reason is that the command you're using doesn't Minimize the window, it moves its position off screen. So when you're clicking in the toolbar it will be minimizing/maximizing as you click, but you just can't see it.

If you wish to make the window visible again later in your code you can just reset the window position with

driver.manage().window().setPosition(new Point(0,0))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM