Selenium WebDriver works but SLOW (Java)

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2012-10-22T22:25:58Z Indexed on 2012/10/23 5:04 UTC
Read the original article Hit count: 209

Code:

    WebDriver driver = new FirefoxDriver();
    driver.get("http://www.cnn.com");
    File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
    FileUtils.copyFile(scrFile, new File("c:\\test\\screenshot.png"));

I am using Selenium WebDriver to take a screenshot of webpages. It runs great. However, from the time I hit run in eclipse to the time the screenshot shows up in my local drive is 7-10 seconds. Most of the latency seems to be launching Firefox.

How can I speed up this process? Is there a way that I can use an already opened Firefox browser to save on opening a new one? Is this code somehow heavy?

Details- Tried on CentOS box and Win7 box both using eclipse. myspeedtest.net shows 22Mbps down and 1 Mbps up.

© Stack Overflow or respective owner

Related posts about selenium

Related posts about webdriver