This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void takeScreenShot(String destDir,String project) | |
{ | |
// Capture screenshot. | |
File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); | |
// Set date format to set It as screenshot file name. | |
DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy__hh_mm_ssaa"); | |
// Create folder under project with name "screenshots" provided to destDir. | |
new File(destDir).mkdirs(); | |
// Set file name using current date time. | |
String destFile = project +"_"+dateFormat.format(new Date()) + ".png"; |
NewerOlder