How to Take Screenshot using WebDriver
Below is the code use it in you function to get the screenshot:
File ScreenShot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); StringBuilder FileName = new StringBuilder("Path or FolderLocation"); FileName.append(ScreenshotFirstName); FileName.append("_"); FileName.append(dateFormat.format(date).toString()); FileName.append(".jpeg"); FileUtils.copyFile(ScreenShot, new File(FileName.toString()));
No comments:
Post a Comment