Hi,
I am using below piece of code for taking screenshot -
public void takeScreenShot(){
Date d=new Date();
String screenshotFile=d.toString().replace(":", "_").replace(" ", "_")+".png";
File srcFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
String filePath ="Screenshots//"+screenshotFile;
try {
FileUtils.copyFile(srcFile, new File(filePath)); //Put Capture in folder "Screenshots" > *WORKING FINE*
} catch (IOException e) {
e.printStackTrace();
}
test.log(LogStatus.INFO,"Screenshot -> "+ test.addScreenCapture(filePath)); //fetch capture from folder "Screenshots" to Extent Report > *NOT WORKING*
}
Folder Structure >
Project
Src
Screenshots
Report
> I am using relative path, so that I can share reports in mail. I understand that I need to share (report+screenshot) folders while sending in mail.
> Right now, In my local when I run this code, I can see screenshot file being saved in .png format in folder : Screenshots, But Report is not fetching these screenshots.
Please help to assist. Many thanks
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/testng-users/f72e8658-61dd-46c4-99ac-22db3a616511n%40googlegroups.com.