Extent Report in Jenkins is displaying blank icon for attached screenshots - selenium

I have generated a runnable jar of my project, and running it on other machine through jenkins.
Jar file executing successfully and generating extent report also,
but there is a blank icon on the place of screenshots.
I have searched on google but did not find any relevant solution to solve my problem.
I am using Intellij IDE and opening the extent report by using the option of "Open in Browser".
When there are more than two screenshots attached(like in above case) with the extent report, it is showing blank icon and showing error when opening the image in new tab.
(When opening the extent report by going into the folder where it is actually saved in the system, it is working as expected).
My code:
#BeforeTest
public void setExtent() {
extent = new ExtentReports(System.getProperty("user.dir")+ "/test-output/Login.html", true);
System.out.println("KKKKKKK");
extentTest = extent.startTest("Start the Execution");
extent.addSystemInfo("Host Name", "Live Contract");
extent.addSystemInfo("User Name", "Shivam Goyal");
extent.addSystemInfo("Environment", "Develop");
extentTest.log(LogStatus.INFO, "Test Execution started");
}
public static String getScreenshot(WebDriver driver, String screenshotName) {
String dateName = new SimpleDateFormat("ddMMyyyyhhmmss").format(new Date());
TakesScreenshot ts = (TakesScreenshot) driver;
File src = ts.getScreenshotAs(OutputType.FILE);
String path = System.getProperty("user.dir")+ "/test-output/"+ screenshotName + dateName + ".png";
File destination = new File(path);
try {
FileUtils.copyFile(src, destination);
}
catch(IOException e){
System.out.println("Capture Failed" +e.getMessage());
}
return path;
}
#Test
public void openURL() throws IOException, InterruptedException, HeadlessException, UnsupportedFlavorException {
System.out.println("test openWeb");
extentTest = extent.startTest("LC1_1.1 - Verify the Login Panel of \"Berater\".");
try {
//Accept All cookies
driver.findElement(By.className(property.getProperty("LiveContractCookies"))).click();
//Test case LC1_1.1 Open the given URL in Browser (Aufruf der entsprechenden URL im Browser)
boolean Homescreen = driver.findElement(By.name(property.getProperty("BeraterLoginPanelName1"))).isDisplayed();
Thread.sleep(3000);
Assert.assertTrue(Homescreen);
} catch (NoSuchElementException e) {
e.printStackTrace();
}
}
#Test
public void checkEntryFields() throws InterruptedException {
extentTest = extent.startTest("LC1_1.2 - Verify the Entry fields on Berater's login panel");
try {
driver.findElement(By.className(property.getProperty("LiveContractCookies"))).click();
WebElement username = driver.findElement(By.name(property.getProperty("username_fieldName")));
WebElement password = driver.findElement(By.name(property.getProperty("password_fieldName")));
username.click();
username.sendKeys("Test123");
password.click();
password.sendKeys("9876554");
Thread.sleep(1000);
System.out.println(username.getText());
String usnm = username.getAttribute("value");
String pass = password.getAttribute("value");
System.out.println("Something happening");
Assert.assertEquals("Test123", usnm);
Assert.assertEquals("98765", pass);
}
catch(Exception e){
e.printStackTrace();
}
}
#AfterMethod
public void tearDown(ITestResult result) {
if(result.getStatus() == ITestResult.FAILURE){
extentTest.log(LogStatus.FAIL, "Test Case Failed is" +result.getName());
extentTest.log(LogStatus.FAIL, "Test Case Failed is" +result.getThrowable());
String screenshotPath = Login.getScreenshot(driver, result.getName());
extentTest.log(LogStatus.FAIL, extentTest.addScreenCapture(screenshotPath));
}
else if(result.getStatus() == ITestResult.SKIP){
extentTest.log(LogStatus.SKIP, "Test Case Skipped is "+result.getName());
}
else if(result.getStatus() == ITestResult.SUCCESS){
extentTest.log(LogStatus.PASS, "Test Case Passed is "+result.getName());
}
extent.endTest(extentTest);
//extent.flush();
driver.quit();
//tempDriver.quit();
//tempDriver.quit();
}
#AfterTest
public void endReport() {
try{
extent.flush();
}
catch(Exception e){
e.getMessage();
}
//extent.close();
}

Related

How can take screenshot of new tab once its loaded completly in selenium

#Test
public void testHeaderlinks() throws IOException {
homePage=new HomePage();
homePage.ClickmenuHolidays();
homePage.Clickmenuattraction();
homePage.Clickmenuhotdeal();
String originalHandle = driver.getWindowHandle();
for(String handle : driver.getWindowHandles()) {
if (!handle.equals(originalHandle)) {
driver.switchTo().window(handle);
driver.close();
}
}
driver.switchTo().window(originalHandle);
}
public static void Takescreenshot(String filename) throws IOException {
File file= ((TakesScreenshot))driver.getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(file,new File("C:\\Users\\User\\Desktop\\POMMabuhayFinal\\src\\main\\java\\Screnshots\\"+filename+".jpg"));
}
In my code i am click hyperlinks in new tab and close those tabs (closing all tabs after all hyperlinks clicks)
My question is how can i take screenshot of opened tabs( i wanna take all new tabs which are open)
Use WebDriverWait to wait for tab/page load and then call your Takescreenshot method while you iterate tabs
#Test
public void testHeaderlinks() throws IOException {
homePage=new HomePage();
homePage.ClickmenuHolidays();
homePage.Clickmenuattraction();
homePage.Clickmenuhotdeal();
String originalHandle = driver.getWindowHandle();
int count = 1;
for(String handle : driver.getWindowHandles()) {
if (!handle.equals(originalHandle)) {
// Initialize WebDriverWait with 15 secs wait timeout or expected wait timeout
WebDriverWait wait = new WebDriverWait(myDriver, 15);
// Wait for page to load
wait.until(webDriver -> ((JavascriptExecutor) myDriver).executeScript("return document.readyState").toString().equals("complete"));
driver.switchTo().window(handle);
// Take screenshot of your current tab
Takescreenshot("tabImage" + String.valueOf(count)) // You can use your own imageName
driver.close();
count++;
}
}
driver.switchTo().window(originalHandle);
}
public static void Takescreenshot(String filename) throws IOException {
File file= ((TakesScreenshot))driver.getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(file,new File("C:\\Users\\User\\Desktop\\POMMabuhayFinal\\src\\main\\java\\Screnshots\\"+filename+".jpg"));
}
Please Try this
public void TakeScreenShot()
{
try
{
string text = AppDomain.CurrentDomain.BaseDirectory + "\\screenshots\\";
if (!Directory.Exists(text))
{
Directory.CreateDirectory(text);
}
if (Directory.Exists(text))
{
string text2 = text + XYZ+ ".jpeg";
if (File.Exists(text2))
{
File.Delete(text2);
}
((ITakesScreenshot)driver).GetScreenshot().SaveAsFile(text2, ScreenshotImageFormat.Jpeg);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}

Null pointer exception while taking screenshot in selenium POM with extent report

A null pointer exception is thrown While trying to take screenshot when the scenario fails. I have an actions class in which i have defiled the capture screenshot method.
public static String capture(WebDriver driver) throws NullPointerException, IOException {
File scrFile;
scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
File Dest = new File("D:\\Dinu\\SeleniumReports\\Test" + System.currentTimeMillis() + ".jpeg");
String filepath = Dest.getAbsolutePath();
org.openqa.selenium.io.FileHandler.copy(scrFile, Dest);
return filepath;
}
Extent reports are implemented using Itestlisterner interface. Below given code for which implements the screenshot method given:
public synchronized void onTestFailure(ITestResult result) {
System.out.println((result.getMethod().getMethodName() + " failed!"));
test.get().fail(result.getThrowable());
try {
String screenshotPath = actions.capture(driver);
test.get().addScreenCaptureFromPath(screenshotPath);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
And am getting the below error: Please help in resolving the same.
public static String getScreenhot(WebDriver driver, String screenshotName) throws Exception {
String dateName = new SimpleDateFormat("yyyyMMddhhmmss").format(new Date());
TakesScreenshot ts = (TakesScreenshot) driver;
File source = ts.getScreenshotAs(OutputType.FILE);
//after execution, you could see a folder "FailedTestsScreenshots" under src folder
String destination = System.getProperty("user.dir") + "/FailedTestsScreenshots/"+screenshotName+dateName+".png";
File finalDestination = new File(destination);
FileUtils.copyFile(source, finalDestination);
return destination;
}
#AfterMethod
public void getResult(ITestResult result) throws IOException{
if(result.getStatus() == ITestResult.FAILURE){
logger.log(LogStatus.FAIL, "Test Case Failed is "+result.getName());
logger.log(LogStatus.FAIL, "Test Case Failed is "+result.getThrowable());
//To capture screenshot path and store the path of the screenshot in the string "screenshotPath"
//We do pass the path captured by this mehtod in to the extent reports using "logger.addScreenCapture" method.
String screenshotPath = ExtentReportsClass.getScreenshot(driver, result.getName());
//To add it in the extent report
logger.log(LogStatus.FAIL, logger.addScreenCapture(screenshotPath));
}else if(result.getStatus() == ITestResult.SKIP){
logger.log(LogStatus.SKIP, "Test Case Skipped is "+result.getName());
}
// ending test
//endTest(logger) : It ends the current test and prepares to create HTML report
extent.endTest(logger);
}

Extent report is throwing Close was called before test could end safely using EndTest

I am getting this error when I am trying to generate extent report.
I have closed the report already with reports.endTest(test);
Here is my code:
#BeforeMethod
public void beforeMethod(Method method) {
test = reports.startTest((this.getClass().getSimpleName() + "::" + method.getName()), method.getName());
test.assignAuthor("Roy");
test.assignCategory("SMOKE TEST");
}
#Test(priority = 0)
public static void initialSetup() throws InterruptedException, IOException {
System.setProperty("webdriver.ie.driver", "\\IEDriverServer.exe");
b = new InternetExplorerDriver();
b.get("https://something.com");
Alert alert = b.switchTo().alert();
String _user_name = "kirstie";
String _password = "88525";
alert.authenticateUsing(new UserAndPassword(_user_name, _password));
b.switchTo().defaultContent();
}
#Test(priority = 1, enabled = true)
public static void secondClient() throws Exception {
b.findElement(By.xpath("//*[#class='main-sidebar open']")).click();
b.findElement(By.xpath("//*[#class='sub-menu group open']/li")).click();
}
#AfterMethod
public void afterMethod(ITestResult iTestResult) throws IOException {
if (iTestResult.getStatus() == ITestResult.FAILURE) {
String screenshotPath = GetScreenshot.capture(driver, "screenShots");
test.log(LogStatus.FAIL, "Screenshot", test.addScreenCapture(screenshotPath));
test.log(LogStatus.FAIL, "Test Case Failed is " + iTestResult.getName());
test.log(LogStatus.FAIL, "Test Case Failed is " + iTestResult.getThrowable());
} else if (iTestResult.getStatus() == ITestResult.SKIP) {
test.log(LogStatus.SKIP, "Test Case Skipped is " + iTestResult.getName());
}
reports.endTest(test);
}
#AfterSuite
public void afterSuite() {
reports.flush();
reports.close();
}
I just Copy and paste the template which I used my project.Hope Your Problem will be solved by using this
WebDriver driver;
ExtentHtmlReporter htmlReporter;
ExtentReports extent;
ExtentTest test;
#BeforeTest
public void setUp() {
// where we need to generate the report
htmlReporter = new ExtentHtmlReporter("Your report Path");
extent = new ExtentReports();
extent.attachReporter(htmlReporter);
// Set our document title, theme etc..
htmlReporter.config().setDocumentTitle("Rentalhomes");
htmlReporter.config().setReportName("Rentalhomes Production Testing");
htmlReporter.config().setTestViewChartLocation(ChartLocation.TOP);
htmlReporter.config().setTheme(Theme.DARK);
}
}
#Test
public void HomepageLogo() throws Exception {
test = extent.createTest("rentalhomesHomePage");
//Your Test
}
#AfterMethod
public void setTestResult(ITestResult result) throws IOException {
if (result.getStatus() == ITestResult.FAILURE) {
test.log(Status.FAIL, result.getName());
test.log(Status.FAIL,result.getThrowable());
//test.fail("Screen Shot : " + test.addScreenCaptureFromPath(screenShot));
} else if (result.getStatus() == ITestResult.SUCCESS) {
test.log(Status.PASS, result.getName());
//test.pass("Screen Shot : " + test.addScreenCaptureFromPath(screenShot));
} else if (result.getStatus() == ITestResult.SKIP) {
test.skip("Test Case : " + result.getName() + " has been skipped");
}
extent.flush();
driver.close();
}
}
Remove //extent.startTest("TestCaseName", "Description"); from your code

TestNG Asserts put under Page Objects are not reflected in the TestNG report for webdriver test

I am working on Java-selenium test framework.
We are calling individual page objects for testing methods viz:
verifyOrderSummary()
These methods sitting inside Page Object will have individual TestNG asserts
Now, when I run my main calling methods / TestNG Tests then, after execution of the test result of the assert is not getting written in the TestNG report.
Kindly advise.
How should I structure my Page Object driven tests, so that- assertings (soft/hard) will get reflected in the final TestNG report.
Many thanks
Hi, Below is one of the key test method( calling various page objects representing various pages):
#Test(dataProvider="BillingDataExcel")
public void dataEntryMethod(String sNo, String sTestCaseName, String sTestDesc, String sAddMedia, String sSupplyVia, String sClock, String sAdvertiser, String sSubtitles, String sBrand, String sPriceModel, String sMarket) throws InterruptedException, IOException {
try{
loginToA5();
navigateToDeliveryDashboard();
softAssert = new SoftAssert();
deliveryLandingPageDataVariant = new DeliveryLandingPageDataVariant(driver);
Thread.sleep(1000);
deliveryLandingPageDataVariant.triggerCreateOrder();
Thread.sleep(1000);
deliveryLandingPageDataVariant.changeCountry(sMarket);
Thread.sleep(1000);
deliveryLandingPageDataVariant.addMedia(sAddMedia, sSupplyVia);
//****XML Driven variant below****
//deliveryLandingPageDataVariant.AddInformation();
deliveryLandingPageDataVariant.AddInformation(sClock,sAdvertiser,sSubtitles,sBrand);
//****XML Driven variant below****
//deliveryLandingPageDataVariant.selectBroadCastDest();
deliveryLandingPageDataVariant.selectBroadCastDest(sNo);
myUtil.TakeSnapShot(driver, "AfterFilling-inData");
deliveryLandingPageDataVariant.submitData();
Thread.sleep(2000);
driver.manage().timeouts().implicitlyWait(40, TimeUnit.SECONDS);
ViewOrderPage viewOrderPage = new ViewOrderPage(driver);
softAssert.assertTrue(viewOrderPage.verifyOrderSummary(sNo,sTestCaseName,myUtil.excelFeederRowCount++));
viewOrderPage.openOrderSummaryAndVerifyDesti(sNo);
/*Below is a Temp hook, before we fix the #After annotation */
driver.close();
driver.quit();
Thread.sleep(1000);
}catch(AssertionError e){
System.out.println("Assertion error or other error -- ");
e.printStackTrace();
} catch(Exception e){
e.printStackTrace();
}
}
And below is the One of Page Object:
public class ViewOrderPage extends Abstractpage {
XMLDataReader xmlDataReader = new XMLDataReader();
#FindBy(css="#angularHolder > div > div > div.clearfix.pbxs.ng-scope > div > div:nth-child(2) > div > div > div:nth-child(2)")
//#FindBy(xpath=".//*[#id='angularHolder']/div/div/div[1]/div/div[2]/div/div/div[2]")
private WebElement QTYValue;
#FindBy(xpath=".//*[#id='angularHolder']/div/div/div[1]/div/div[3]/div/div[1]/div[2]/span")
private WebElement subTotalValue;
#FindBy(xpath="//button[#data-role='viewReport']")
private WebElement viewOrderSummaryButton;
private final String WAIT_WHEEL_PATH =".//*[#id='angularHolder']/div/div/div[2]/div[2]";
private int i;
String STDCell;
String EXPCell;
String STACell;
private final String DELIVER_TO_STRING=".//*[#id='report']/div/div[2]/div[4]/table/tbody/tr";
public ViewOrderPage(WebDriver driver){
this.driver=driver;
AjaxElementLocatorFactory aFactory= new AjaxElementLocatorFactory(driver, 20);
PageFactory.initElements(aFactory, this);
myWait=new WebDriverWait(driver, 120);
myWait.until(ExpectedConditions.elementToBeClickable(viewOrderSummaryButton));
//myWait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath(WAIT_WHEEL_PATH));
}
#SuppressWarnings("finally")
public boolean verifyOrderSummary(String sNo, String sTestCaseName, int feederRowCount) throws Exception{
int subTotal=-1;
int qty=-1;
boolean valueMatched = false;
System.out.println("\n=========================Verify Order Summary Section=================================");
System.out.println("**Quantity =" + getQTY());
System.out.println("**subTotal ="+ getSubTotal());
try {
ExcelUtils.setExcelFile(System.getProperty("user.dir")+"/src/test/java/com/SAPAutomation/testData/BillingData.xlsx","TestResults");
ExcelUtils.setCellData(sNo, feederRowCount, 0);
ExcelUtils.setCellData(sTestCaseName, feederRowCount, 1);
ExcelUtils.setCellData(getQTY(), feederRowCount, 2);
ExcelUtils.setCellData(getSubTotal(), feederRowCount, 3);
System.out.println("Test Results Read: "+ (String.valueOf(ExcelUtils.getCellData(feederRowCount, 4)).toLowerCase()));
if(getSubTotal().toLowerCase().equals("£"+String.valueOf(ExcelUtils.getCellData(feederRowCount, 4)).toLowerCase()+".00")){
valueMatched=true;
System.out.println("\n**Subtotle of "+feederRowCount+" Matched**");
ExcelUtils.setCellData("PASS", feederRowCount, 5);
}else{
ExcelUtils.setCellData("FAIL", feederRowCount, 5);
System.out.println("\n**Subtotle of "+feederRowCount+" didn't match**");
valueMatched=false;
}//end else
// try {
// Assert.assertEquals(getSubTotal(), String.valueOf(ExcelUtils.getCellData(feederRowCount, 4)), "Quantity Matched");
// } catch (Exception e) {
// e.getMessage();
//
// Reporter.log("Assertion error in Verify Order summary:"+ e.getMessage());
// }
} catch (Exception e1) {
e1.printStackTrace();
}finally{
myUtil.takeFieldSnapshot(driver, driver.findElement(By.xpath(".//*[#id='angularHolder']/div/div/div[1]/div")), "OrderSummaryHighlight");
return valueMatched;
}
}
#SuppressWarnings("finally")
private String getQTY(){
driver.manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
String QTY = "0";
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
try{
return QTY=QTYValue.getText();
}catch(Exception e){
e.getStackTrace();
return QTY;
}
}
private String getSubTotal(){
String subTotal="";
try{
return subTotal = subTotalValue.getText();
}catch (Exception e){
e.getStackTrace();
return subTotal;
}
}
public void openOrderSummaryAndVerifyDesti(String sNo) throws Exception{
String mainWinHande=driver.getWindowHandle();
viewOrderSummaryButton.click();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
Set<String> handles = driver.getWindowHandles();
for(String handle : handles)
{
if(!mainWinHande.equals(handle))
{
driver.switchTo().window(handle);
String attriAndDestinations[][]=ExcelUtils.getTableArray(System.getProperty("user.dir")+"/src/test/java/com/SAPAutomation/testData/BillingData.xlsx", sNo, myUtil.GLOBAL_MAX_COLUMN_COUNT);
ExcelUtils.setExcelFile(System.getProperty("user.dir")+"/src/test/java/com/SAPAutomation/testData/BillingData.xlsx",sNo);
String destinationCell="";
STDCell="--";
EXPCell="--";
STACell="--";
int broadcasterTableSize= driver.findElements(By.xpath(DELIVER_TO_STRING)).size();
for(i=1;i</*broadcasterTableSize*/attriAndDestinations.length+1;i++){
int xPathDIVCounter=i+2;
//Get Destination
destinationCell=driver.findElement(By.xpath(DELIVER_TO_STRING+"["+xPathDIVCounter+"]/td[2]")).getText();
ExcelUtils.setCellData(destinationCell, i, 3);
System.out.println("\n**DEBUG: Destination Cell value ="+destinationCell);
//Get Attribute
//--STD
STDCell=driver.findElement(By.xpath(DELIVER_TO_STRING+"["+xPathDIVCounter+"]/th[1]")).getText();
ExcelUtils.setCellData(STDCell, i, 4);
System.out.println("\n**DEBUG: STD Cell value ="+STDCell);
//Get Attribute
//--EXP
EXPCell=driver.findElement(By.xpath(DELIVER_TO_STRING+"["+xPathDIVCounter+"]/th[2]")).getText();
ExcelUtils.setCellData(EXPCell, i, 5);
System.out.println("\n**DEBUG: EXP Cell value ="+EXPCell);
//Get Attribute
//--STA ** SPECIAL CASE** TO DO
// EXPCell=driver.findElement(By.xpath(DELIVER_TO_STRING+"["+xPathCounter+"]/th[3]")).getText();
// ExcelUtils.setCellData(STDCell, i, 6);
}//end for
// tallyTableRowsWithNumberOfDestinations(attriAndDestinations.length);
}//end if
}//end for
driver.close(); // close the poped-up report window
driver.switchTo().window(mainWinHande);
}
private void tallyTableRowsWithNumberOfDestinations(int destinationSize){
int rowCount= driver.findElements(By.xpath(DELIVER_TO_STRING)).size();
System.out.println("\n** Table row Count: "+rowCount +"| destinations ArraySize: "+destinationSize);
try {
softAssert.assertEquals(rowCount-1, destinationSize+1, "Table rowcount didn't match with the Number of destinations selected");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void concludeAsserts(){
softAssert.assertAll();
}
}
As mentioned in the comments, you should separate your test logic out of your page objects. The page objects should report or alter the current state of the page, and it's up to the tests to decide whether what the page object reports is correct.
Break your page object method up more so that each one sets or checks one item on the page, then check each of those items from your test...
Assert.AreEqual(thePage.getOrderTotal(), expectedValue1);
Assert.AreEqual(thePage.getOrderItem(1), expectedValue2);
Assert.AreEqual(thePage.getOrderItem(2), expectedValue3);
Assert.AreEqual(thePage.getAnotherThing(), expectedValue4;
...
If you find yourself doing these things over and over again in each test, you may find it useful to bunch these asserts together into a helper method in your test class, which I suspect might be the intended purpose of verifyOrderSummary()

Unable to add screenshot in ReportNG HTML report

I am trying to take a screenshot for failure methods and also want to put the same in my Report, I am able to take the screenshot but unable to show the same in HTML report. Following is my code, friends any clue on this ?
public class SB1 {
private static Logger logger = Logger.getLogger(SB1.class);
WebDriver driver = new FirefoxDriver();
#Test
public void Testone() {
driver.get("http://www.google.com/");
assert false;
}
public void catchExceptions(ITestResult result) {
System.out.println("result" + result);
String methodName = result.getName();
System.out.println(methodName);
if (!result.isSuccess()) {
try {
String failureImageFileName = new SimpleDateFormat("MM-dd-yyyy_HH-ss").format(new GregorianCalendar().getTime())+ ".png";
File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File(failureImageFileName));
String userDirector = System.getProperty("user.dir") + "/";
Reporter.log("<a href=\""+ userDirector + failureImageFileName +"\"><img src=\"file:///" + userDirector
+ failureImageFileName + "\" alt=\"\""+ "height='100' width='100'/> "+"<br />");
Reporter.setCurrentTestResult(null);
} catch (IOException e1) {
e1.printStackTrace();
}
}
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();
}
}