Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 TakesScreenshotTest {
- public static void main(String[] args) throws IOException {
- WebDriver myTestDriver = new FirefoxDriver();
- myTestDriver.get("http://tinyurl.com/6d7xz7k");
- myTestDriver.manage().window().maximize();
- myTestDriver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
- File scrFile = ((TakesScreenshot)myTestDriver).getScreenshotAs(OutputType.FILE);
- FileUtils.copyFile(scrFile, new File("c:\\careerbuilder.jpg"));
- myTestDriver.quit();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement