Screenshot added in Extended report appears to be Broken | Selenium Forum
Jeckson james Posted on 12/05/2021

Iam using following dependency for extended reports, tried lower versions as well, Still image attached in report appeasr to be broken


This is the code used to get screenshot

public void takeScreenshot() {
Date d=new Date();
String screenshotFile=d.toString().replace(":", "_").replace(" ", "_")+".JPG";
// take screenshot in file format of selenium
File srcFile = ((TakesScreenshot)getcon().getcurrentDriver()).getScreenshotAs(OutputType.FILE);
try {
// get the dynamic folder name
FileUtils.copyFile(srcFile, new File(ExtentManger.screenshotFolderPath+screenshotFile));
//put screenshot file in reports
test.log(Status.INFO,"Screenshot-> "+ test.addScreenCaptureFromPath(ExtentManger.screenshotFolderPath+screenshotFile));
//test.log(Status.INFO,"Screenshot-> "+ MediaEntityBuilder.createScreenCaptureFromPath(ExtentManger.screenshotFolderPath+screenshotFile).build());
//test.log(Status.INFO,"Screenshot-> "+ test.addScreenCaptureFromPath(ExtentManger.screenshotFolderPath+screenshotFile,ExtentManger.screenshotFolderPath+screenshotFile));
} catch (IOException e) {
// TODO Auto-generated catch block

Whne i inspect the report, i can see the image file path , but do not load even if i try to load in new page

Am using a mac with IntelliJ

Ashish Replied on 18/05/2021

Please open the report in chrome

Jeckson james Replied on 19/05/2021

I tried opening in chrome, firefox and safari, its appears to be broken

Ashish Replied on 19/05/2021

Print this value -

is it printing valid path?

Jeckson james Replied on 20/05/2021

*******/Users/baba/Documents/AoAutomation/reports/Thu May 20 19-42-56 IST 2021/screenshots/Thu_May_20_19_43_06_IST_2021.JPG


Yes its is printing proper path. Am using mac , InteliJ