How can I control Chromedriver open window size?

Nimrod_G picture Nimrod_G · Apr 30, 2014 · Viewed 98.4k times · Source

I'm using Selenium WebDriver for automation and I'm using Chromedriver.

I have noticed that when my driver runs and opens the chrome browser, it opens the browser with a strange size. I tried to fixed it but in vain.

Does anybody know how can I change it?

Answer

Yonatan Kiron picture Yonatan Kiron · Apr 3, 2017

Python

Drivers

chrome = 57.0.2987.133
chromedriver = 2.27.440174

Code:

from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument("--window-size=1920,1080")
driver = Chrome(chrome_options=chrome_options)