October 2018
Intermediate to advanced
192 pages
5h 12m
English
Generating screenshots for our test execution is an important part of the framework. It's as equally important as generating logs and reports.
The following code shows the traditional way of taking screenshots:
public class TakeScreenShot { public void takeScreenPrint(String[] args) { System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + "\\src\\main\\resources\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); driver.get("http://www.google.com"); File src = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); try { FileUtils.copyFile(src, new File("C:/selenium/error.png")); } catch (IOException e) { throw new IOException();Read now
Unlock full access