Unable to add screenshot in ReportNG HTML report Unable to add screenshot in ReportNG HTML report selenium selenium

Unable to add screenshot in ReportNG HTML report


Have you set ESCAPE_PROPERTY to false? This is what you will have to do if you want reportng to post the screenshot -

    private static final String ESCAPE_PROPERTY = "org.uncommons.reportng.escape-output";

and in your setUp-

    System.setProperty(ESCAPE_PROPERTY, "false");


I tried this. It seems like if you set the System Property to false, it removes the escaping from the ENTIRE log... From what I can tell, the report is generated after the test, with whatever the system property is set to at the time. I want to insert the screenshot (which worked with above code) but I do not want to remove the other formatting (br tags).


You can use following code.

Reporter.log("<br>Chrome driver launched for ClassOne</br>");

Or you can use customize method, where you do not need to append the br tag everytime, use following customized method.

public void customLogReport(String testCaseDescription) throws Exception{ try{ Reporter.log("<br>" + testCaseDescription + "</br>"); }catch(Exception e){ e.printStackTrace(); } }