SCREENSHOT
package mypackage;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
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{
System.setProperty("webdriver.gecko.driver","C:\\Browser\\geckodriver.exe");
WebDriver driver=new FirefoxDriver();
driver.manage().window().maximize();
driver.get("http://www.google.com");
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
TakesScreenshot scrShot =((TakesScreenshot)driver);
File SrcFile=scrShot.getScreenshotAs(OutputType.FILE);
File DestFile=new File("C:\\Users\\ramak\\OneDrive\\Pictures/screenshots/img1.png");
FileUtils.copyFile(SrcFile, DestFile);
System.out.println("screenshot");
}
}