Archive
Splinter: open Firefox in fullscreen mode
Problem
With Splinter you can automate a browser window (click on a button, type in some text, etc). You can also use a Firefox instance beside Chrome and some other browsers. But how to open the Firefox instance in fullscreen (as if you had clicked on the “maximize” button)? Strangely, there is no command-line option for this :(
Solution
Well, under Linux there are some tools that allows you to interact with windows:
- xwininfo
- xdotool
- wmctrl
When the Firefox instance is opened, it becomes the active window and I ask its window ID with “xdotool getactivewindow”. Then, with “wmctrl” I can toggle this window to fullscreen.
Demonstration:
jabba@jabba-uplink:~$ xdotool getactivewindow 109051940 jabba@jabba-uplink:~$ python Python 2.7.4 (default, Apr 19 2013, 18:28:01) [GCC 4.7.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> hex(109051940) '0x6800024' jabba@jabba-uplink:~$ wmctrl -i -r 0x6800024 -b toggle,maximized_vert,maximized_horz
The same in Python is available in my jabbapylib library here.
Splinter patch: open the Chrome browser window in a maximized way
Problem
With Splinter, I would like to open the Chrome browser window in a maximized way, i.e. it should fill the whole screen.
Solution
As a temporary solution, I patched my /usr/local/lib/python2.7/dist-packages/splinter/driver/webdriver/chrome.py file by adding the following line:
options.add_argument("--start-maximized")
I also reported this idea to the authors of Splinter here.
