premonition
premonition

Reputation: 299

Chromedriver maximize issue

I'm new to this forum as well as to programming and selenium. I'm trying to maximize my chrome browser using selenium python(using the below code) and everytime selenium opens the browser it would not maximize the whole window.It maximizes only half the screen with "data:," already filled on the address bar.

self.driver = webdriver.Chrome() 
self.driver.maximize_window()

I also tried

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

but doesn't help

Screenshot of the browser

Upvotes: 4

Views: 4580

Answers (2)

alecxe
alecxe

Reputation: 474161

There is an open issue in ChromeDriver which is specific to Mac OS X.

What I remember helped was to first set the dimensions explicitly and then maximize:

driver.set_window_size(1200, 800)
driver.maximize_window()

Upvotes: 2

middlestump
middlestump

Reputation: 1055

Just looked at my code and noticed that my import is

 from selenium.webdriver.chrome.options import Options

And the rest of the code is

 options = Options() 
 options.add_argument("--start-maximized") 
 driver=webdriver.Chrome(chrome_options=options) 

This does work

Upvotes: 9

Related Questions