How to resize current browser window in Selenium WebDriver with Java?

后端 未结 3 1540
无人及你
无人及你 2021-02-07 07:10

I need to resize the browser as 300x400 during executing the Selenium automated tests. How can I resize the browser window in Selenium WebDriver (aka, Selenium 2) with Java?

3条回答
  •  不思量自难忘°
    2021-02-07 07:51

    For Responsive Design it's better if you don't use fixed data, in this case screen resolution - users need most often (cause it's much less prone to errors) :

    _driver.manage().window().maximize();
    

    or

    _driver.manage().window().fullScreen();
    

提交回复
热议问题