Screenshot
Taking Screenshot for an Application:
public class Screenshot {
public static void main(String[] args) throws IOException {
System.setProperty("webdriver.chrome.driver",
"E:\\selenium\\SeleniumStable\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://www.echoecho.com/htmlforms10.htm");
List<WebElement>lst=driver.findElements(By.name("group1"));
//below 2 lines are needed to work with Screenshorts.
File scfile=((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(scfile,new File("E:\\sudheer.jpg"));
}
}
public class Screenshot {
public static void main(String[] args) throws IOException {
System.setProperty("webdriver.chrome.driver",
"E:\\selenium\\SeleniumStable\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://www.echoecho.com/htmlforms10.htm");
List<WebElement>lst=driver.findElements(By.name("group1"));
//below 2 lines are needed to work with Screenshorts.
File scfile=((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(scfile,new File("E:\\sudheer.jpg"));
}
}
Comments
Post a Comment