Tuesday, May 29, 2012

How to capture the full page screenshot in webdriver

In order to get the full page screenshot using web driver,

//Include these packages in the script.
import java.io.File;
import org.apache.commons.io.FileUtils;

//Add these snippet to your code.
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File("c:\\path\\filename.jpg"),true);

No comments:

Post a Comment