How to minimize the browser window in Selenium WebDriver 3

前端 未结 7 1122
南方客
南方客 2021-01-05 18:14

After maximizing the window by driver.manage().window().maximize();, how do I minimize the browser window in Selenium WebDriver with Java?

7条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-05 18:34

    Unfortunately, Selenium does not provide any built-in function for minimizing the browser window. There is only the function for maximizing the window. But there is some workaround for doing this.

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

提交回复
热议问题