Extent Report is not fetching images on using relative path.

198 views
Skip to first unread message

Snehil Kataria

unread,
May 28, 2021, 6:34:20 AM5/28/21
to testng-users

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 

⇜Krishnan Mahadevan⇝

unread,
May 28, 2021, 7:13:45 AM5/28/21
to testng-users
Extent Reports is not owned/maintained by TestNG. Please post on the Extent Reports forum with this question.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/


--
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.
Reply all
Reply to author
Forward
0 new messages