I wanted to know how to maximize a browser window using the Python bindings for Selenium 2-WebDriver.
You can use browser.maximize_window() for that
The trunk version has webdriver.set_window_position(), webdriver.set_window_size() methods:
#!/usr/bin/env python
import time
from contextlib import closing
from selenium.webdriver import Firefox # pip install selenium
with closing(Firefox()) as browser:
browser.set_window_position(0, 0) #NOTE: 0,0 might fail on some systems
browser.set_window_size(800, 600)
time.sleep(2)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With