email2vimalraj / CucumberExtentReporter

A plugin to generate the cucumber jvm custom html report using ExtentsReport
http://www.vimalselvam.com/cucumber-extent-reporter/
MIT License
58 stars 74 forks source link

screenshot is not showing in Html report #80

Closed 15d6d closed 6 years ago

15d6d commented 6 years ago

Hi vimal i am using updated dependency of extent-reports ,I am not getting screenshot in my extent html report ,below the code :if (scenario.isFailed()) { try { scenario.write("Current Page URL is " + driver.getCurrentUrl()); byte[] screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES); String randomString = getRandomString(5); File file = new File( "target/screenshotfailure/screenshot" + scenario.getName() + "" + randomString + ".png"); file.getParentFile().mkdirs(); FileOutputStream out = new FileOutputStream(file); out.write(screenshot); scenario.embed(screenshot, "image/png"); out.close(); extentTest.addScreenCaptureFromPath(path + "/target/screenshot-failure/screenshot" + scenario.getName()+ "_" + randomString + ".png"); extentTest.log(Status.FAIL, path + "/target/screenshotfailure/screenshot" + scenario.getName()+ "_" + randomString + ".png");

        } catch (Exception somePlatformsDontSupportScreenshots) {
            System.err.println(somePlatformsDontSupportScreenshots.getMessage());
        }[report url ](https://drive.google.com/file/d/1Mv8vyYg0jJWygDSvBa-Hb1nviPJYM0CO/view?usp=sharing)
15d6d commented 6 years ago

I resolved my problem.

ashokkumarg commented 6 years ago

How did you resolved can you tell the solution