简体   繁体   中英

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 this source , but this is giving syntax errors.

How can I do this?

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

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

driver.set_window_size(1400,1000)

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

For Java, the Dimension import has to be:

import org.openqa.selenium.Dimension;

and it won't give syntax errors

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM