How to minimize the browser window in Selenium WebDriver 3

前端 未结 7 1125
南方客
南方客 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:35

    I'm using Selenium WebDriver (Java) 3.4.0 and have not found the minimize function either. Then I'm using the following code.

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

    We need to import the following for the Point function.

    import org.openqa.selenium.Point;
    

提交回复
热议问题