How to send extent reports in email with screenshots

How to send extent reports in email with screenshots
How to send extent reports in email with screenshots,While working with Extent Reports,we are able to take the screenshots ,able to attach into Extent html Reports,but while sending those reports in email screenshots not displays.

I’ve figured how to display screenshots in Extent Reports,if html file location is changed from one folder to another folder with the simple trick as per Extent Reports site directions,already this question is asked in GitHub in Anshu Arora blog,they have given some directions to solve this problem but no one has solved this.
 

Send Extent Reports in Email

Code Sample

public class SampleTest{
String concatenate = ".";
String screenshot_Name;
// FAIL Screenshots
screenshot_Name = concatenate + getScreenshot(driver, "TestName");
Reporting.testFailLogs("Taking Screenshot for FAIL Step-Reason");
Reporting.screenCapture("TestName", screenshot_Name);
System.out.println("Script Exception Error Message: " + e);

public static String getScreenshot(WebDriver driver, String screenshotName) throws Exception {
File sourceFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
String imgPath = "./" +reports/Screenshots/" + screenshot + "_"+ System.currentTimeMillis() + ".png";
File path = new File("./Reports/" + imgPath);
FileUtils.copyFile(sourceFile, path);
return imgPath;
}
public static Object screenCapture(String logdetails, String imagepath) throws IOException {
// report with snapshot
test.log(Status.INFO, logdetails, MediaEntityBuilder.createScreenCaptureFromPath(imagepath).build());
return test;
}
}

 

ALSO READ  Selenium Xpath Tutorial Step by Step Guide

Please provide your valuable comments on this How to send Extent reports in email with screenshots and give me feedback on this code.Thank you for reading…

How to send the screenshots alongwith HTML report via email

how to email extent report
emailable extent report
how to send extent report in email through jenkins
how to send extent report through email
how to email extent report in jenkins
how to attach screenshot in extent report in selenium
add screenshot in extent report c#
emailable extent reports with jenkins

Rajesh K

Leave a Reply

Your email address will not be published. Required fields are marked *