user61629 user61629 - 1 year ago 363
Python Question

How to set window size using phantomjs and selenium webdriver in python

I'm trying to get a full sized browser screenshot with phantomjs driven by python webdriver . right now my screenshot is measured at 927 x 870, I'd like to reset it. I have tried:

driver.manage().Window().setSize(new Dimension(1400,1000))

based on!msg/phantomjs/f29lxBQNLqY/_Pyi7j9EEVQJ but this is giving syntax errors.

How can I do this?

Answer Source

Because that's Java. Python's documentation is here.

There's a method called set_window_size, which is defined here:


Further reading: How to get window size, resize or maximize window using Selenium WebDriver

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download