How to maximize browser while running Selenium tests


When I run my Selenium test the browser is not run maximized.  My website employs adaptive design so the menu gets collapsed on smaller screens. The window is just small enough that my menu is being collapsed during playback and causing my test to fail.


Add the following line to your test before you navigate to the URL under test.


Adding this line will cause the browser window to be maximized before the test is executed.

Add comment