How do I resize the window in Chrome and Firefox when testing with Selenium?
For Chromejust add before "webdriver.Chrome" init:
chrome_options.add_argument("--window-size=1920x1080")
For all browsers:
There is an official selenium python binding for that: http://selenium.googlecode.com/git/docs/api/py/webdriver_remote/selenium.webdriver.remote.webdriver.html#selenium.webdriver.remote.webdriver.WebDriver.set_window_size
driver.set_window_size(1920, 1080)
or
driver.maximize_window()
or with javascript
driver.execute_script("window.resizeTo(1920,1080)")