Tuesday, 8 April 2014

Capture Screen or Screen shot of the full webpage using Selenium WebDriver



import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.apache.commons.io.FileUtils;

File sourcefile=((TakesScreenshot)driver1).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(sourcefile,new File("D:\\Selenium_Testing\\Selenium_Webdriver_Project\\Screenshot.png") );

We can see the screenshot output in above file location.

No comments:

Post a Comment