How to Maximize window in chrome using webDriver (python)

前端 未结 9 1879
天命终不由人
天命终不由人 2021-01-30 08:29

Is there a way to maximize the chrome browser window using python selenium WebDriver?

Note: I am using Chrome Driver 23.0 Any solution on this would be greatly appreciat

相关标签:
9条回答
  • 2021-01-30 09:06

    I do the following:

    from selenium import webdriver
    browser = webdriver.Chrome('C:\chromedriver.exe')
    browser.maximize_window()
    
    0 讨论(0)
  • 2021-01-30 09:10

    Based on what Janek answered, this worked for me (Linux):

    from selenium import webdriver
    
    options = webdriver.ChromeOptions()
    options.add_argument("--start-maximized")
    
    driver = webdriver.Chrome(chrome_options=options)
    
    0 讨论(0)
  • 2021-01-30 09:11

    For MAC or Linux:

    ChromeOptions chromeOptions = new ChromeOptions();
    chromeOptions.addArguments("--kiosk");
    driver = new ChromeDriver(chromeOptions);
    

    For Windows:

    ChromeOptions chromeOptions = new ChromeOptions();
    chromeOptions.addArguments("--start-maximized");
    driver = new ChromeDriver(chromeOptions);
    
    0 讨论(0)
提交回复
热议问题