screenshot in Selenium
import java.io.File;import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class ScreenShot {
public static void main(String[] args) throws IOException, InterruptedException {
WebDriver driver=new FirefoxDriver();
driver.navigate().to("http://www.facebook.com/");
//Capturing
File myImg=((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
String myP="G:/myimg/test.jpg";
FileUtils.copyFile(myImg, new File(myP));
Thread.sleep(2000);
driver.close();
}
}