Hi Team,
I am able to capture ss in Extent Report Log in POM framework but when I sent the .html file for review the image is not found. How to overcome this issue?
Thanks,
Abhishek
Instructor
Ashish Thakur Replied on 31/07/2019
In this case, you can zip the directory and send the content.
Meaning to I need to send the entire project everytime for reporting. I was send a zip file which had 2 folders, one with the .html file and other with ss. The code top capture ss I used from your POM Module.
public void takeScreenShot(WebDriver webdriver, ExtentTest test) throws InterruptedException{
Thread.sleep(2000);
Date d=new Date();
String screenshotFile=d.toString().replace(":", "_").replace(" ", "_")+".png";
String filePath = System.getProperty("user.dir")+"\\ExtentReports\\screenshots\\"+screenshotFile;
// store screenshot in that file
File scrFile = ((TakesScreenshot)webdriver).getScreenshotAs(OutputType.FILE);
}
try {
FileUtils.copyFile(scrFile, new File(filePath));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
test.log(LogStatus.INFO,test.addScreenCapture(filePath));
Instructor
Ashish Thakur Replied on 08/08/2019
No, we have code for zipping and mail. Discussed in Module 24. You'll get to know how you can zip the report contents and mail these