How can I control Chromedriver open window size? How can I control Chromedriver open window size? selenium selenium

How can I control Chromedriver open window size?


Python

Drivers

chrome = 57.0.2987.133chromedriver = 2.27.440174

Code:

from selenium.webdriver.chrome.options import Optionschrome_options = Options()chrome_options.add_argument("--window-size=1920,1080")driver = Chrome(chrome_options=chrome_options)


Use this for your custom size:

driver.manage().window().setSize(new Dimension(1024,768));

you can change your dimensions as per your requirements.


C# version of @yonatan-kiron's answer, and Selenium's using statement from their example code.

ChromeOptions chromeOptions = new ChromeOptions();chromeOptions.AddArgument("--window-size=1300,1000");using (IWebDriver driver = new ChromeDriver(chromeOptions)){    ...}