2

我已经开始使用 Selenium WebDrivers 来自动化一些性能测试。我发现我们可以在页面完成加载后使用 WebDrivers 截取页面截图:http: //seleniumhq.org/docs/04_webdriver_advanced.html#taking-a-screenshot。但是,我希望能够在页面加载时截取屏幕截图以分析其加载时间和模式,就像webpagetest 所做的那样(http://www.webpagetest.org/)。是否有一个 API 可用于使用 WebDrivers 完成此任务?

我正在使用 FirefoxWebDriver 和 Java 客户端。我感谢帮助或提示。

谢谢!

4

1 回答 1

1

Since, I found out that the RemoteWebDriver's get calls are blocking and even the getScreenshot calls are blocking, I decided to run java.awt.Robot in a separate thread and capture screenshots while the WebDriver loads the page.

The only caveat is that the browser instance opened up by the WebDriver has to be in the front of the screen to take snapshots correctly. I am exploring if Robot can take snapshots on an Xvfb display, which would be just awesome and would work for my purposes.

于 2011-12-21T19:38:33.340 回答