package com.examples;
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.chrome.ChromeDriver;
public class Screenshot_05 {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
System.setProperty("Webdriver.chrome.driver", "chromedriver");
WebDriver wd = new ChromeDriver();
wd.get("http://google.com");
File fl = ((TakesScreenshot) wd).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(fl, new File("sc.png"));
}
}
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.chrome.ChromeDriver;
public class Screenshot_05 {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
System.setProperty("Webdriver.chrome.driver", "chromedriver");
WebDriver wd = new ChromeDriver();
wd.get("http://google.com");
File fl = ((TakesScreenshot) wd).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(fl, new File("sc.png"));
}
}
No comments:
Post a Comment