splinter icon indicating copy to clipboard operation
splinter copied to clipboard

idea: open browser window maximized

Open jabbalaci opened this issue 13 years ago • 8 comments

Hi,

I would like to open the Chrome browser window in a maximized way, i.e. it should fill the whole screen. As a temporary solution, I patched my splinter/driver/webdriver/chrome.py file by adding the following line:

options.add_argument("--start-maximized")

It would be nice to create a browser this way for instance:

options = ["--start-maximized"] br = Browser('chrome', options=options)

Best,

Laszlo

jabbalaci avatar Dec 28 '12 08:12 jabbalaci

Hi Laszlo, In which scenario you missed this feature? How portable is it?

Thanks!

fsouza avatar Dec 28 '12 11:12 fsouza

Hi,

I wanted to take a screenshot of a specific area of an opened webpage. If the window is opened maximized, this area is always at the same place so I can grab a fix area. If it's not maximized, the browser window is sometimes opened on the left, sometimes on the right, so in this case I had to locate the area that I wanted to grab. So the maximized window made everything much simpler for me.

I don't know how portable it is. What I wrote is specific for Chrome. I tried it under Linux.

Thanks and best wishes,

Laszlo

jabbalaci avatar Dec 28 '12 11:12 jabbalaci

I see. I like the idea of being able to give extra options to the underlying driver.

I asked about portability because "maximize" is not the same thing on Mac OS X and Linux.

fsouza avatar Dec 28 '12 11:12 fsouza

As far as I know, you can maximize the browser using the underlying driver:

br = splinter.Browser('chrome')
br.driver.maximize_window()

Droogans avatar Jul 19 '13 22:07 Droogans

@Droogans it only works with no headless drivers based on webdriver. Like firefox and chrome.

andrewsmedina avatar Jul 19 '13 23:07 andrewsmedina

+1 on adding support to pass options while creating a browser instance. I needed to pass --proxy-server and had to patch chrome.py

sidhant avatar Sep 23 '13 18:09 sidhant

@sidhant can you paste your patch to me?

andrewsmedina avatar Sep 23 '13 21:09 andrewsmedina

Since #494, you can pass options to the Browser instance.

javascript-error avatar Apr 02 '21 03:04 javascript-error