How to Maximize window in chrome using webDriver (python)

PythonSeleniumSelenium Chromedriver

Python Problem Overview


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 appreciated!

Python Solutions


Solution 1 - Python

You could use ChromeOptions and set suitable argument:

options = ChromeOptions()
options.add_argument("--start-maximized")
driver = ChromeDriver(options)

Solution 2 - Python

Nothing worked for me except:

driver.set_window_size(1024, 600)
driver.maximize_window()

I found this by inspecting selenium/webdriver/remote/webdriver.py. I've never found any useful documentation, but reading the code has been marginally effective.

Solution 3 - Python

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);

Solution 4 - Python

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)

Solution 5 - Python

Try this:

driver.manage().window().maximize();

Solution 6 - Python

This works for me, with Mac OS Sierra using Python,

options = webdriver.ChromeOptions()
options.add_argument("--kiosk")
driver = webdriver.Chrome(chrome_options=options)

Solution 7 - Python

I do the following:

from selenium import webdriver
browser = webdriver.Chrome('C:\chromedriver.exe')
browser.maximize_window()

Solution 8 - Python

Try

ChromeOptions options = new ChromeOptions();
options.addArguments("--start-fullscreen");

Solution 9 - Python

try this, tested on windows platform and it works fine :

from selenium import webdriver
browser = webdriver.Chrome('C:\\Users\\yeivic\\Downloads\\chromedriver')
browser.fullscreen_window()
browser.get('http://google.com/')

Solution 10 - Python

this works for me

driver.maximize_window()
driver.get(url)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNaveen SubramaniView Question on Stackoverflow
Solution 1 - PythonJanek KrólikowskiView Answer on Stackoverflow
Solution 2 - PythonTom RoseView Answer on Stackoverflow
Solution 3 - PythonMukesh RajputView Answer on Stackoverflow
Solution 4 - PythonsmotttView Answer on Stackoverflow
Solution 5 - PythonroncsakView Answer on Stackoverflow
Solution 6 - PythongsunView Answer on Stackoverflow
Solution 7 - PythonLimboView Answer on Stackoverflow
Solution 8 - Pythonarctic_monkeyView Answer on Stackoverflow
Solution 9 - PythonVictor MarrerpView Answer on Stackoverflow
Solution 10 - PythonAntonis PapadakisView Answer on Stackoverflow