System.setProperty("org.uncommons.reportng.escape-output", "false") ReportNG screenshot

386 views
Skip to first unread message

Debanjana Das

unread,
Mar 4, 2019, 10:56:46 PM3/4/19
to Selenium Users
Hi ,

System.setProperty("org.uncommons.reportng.escape-output", "false");

is not capturing the link in ReportNG HTML report. The full code is


package com.w2a.TestCases;


import org.testng.Assert;

import org.testng.Reporter;

import org.testng.annotations.Test;

import java.io.File;

import org.openqa.selenium.By;

import com.w2a.base.TestBase;


public class BankManagerLoginTest extends TestBase{

@Test

public void BankManagerLogin() throws InterruptedException

{

System.setProperty("org.uncommons.reportng.escape-output", "false");

driver.findElement (By.cssSelector(or.getProperty("bmlBTN"))).click();

Thread.sleep(3000);

Assert.assertTrue(isElementPresent(By.cssSelector(or.getProperty("addCustBtn"))),"Login Not Successful");

log.debug ("Login successfully executed");

Reporter.log("Login Successfully executed");

Reporter.log("<a href= "+ "/Users/sahiluppal/eclipse-workspace/DataDrivenFramework/IMG_4288 (1).jpeg/" +" Screenshot </a>");

}


}


The POM.XML has the following jars added: 

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >

<modelVersion>4.0.0</modelVersion>

  <groupId>WebDriverTest</groupId>

  <artifactId>WebDriverTest</artifactId>

  <version>0.0.1-SNAPSHOT</version>

    <dependencies>

        <dependency>

             <groupId>junit</groupId>

             <artifactId>junit</artifactId>

             <version>4.12</version>

             <scope>test</scope>

        </dependency>

        <dependency>

            <groupId>org.seleniumhq.selenium</groupId>

            <artifactId>selenium-java</artifactId>

            <version>3.141.59</version>

</dependency>

        <dependency>

            <groupId>org.testng</groupId>

            <artifactId>testng</artifactId>

            <version>6.14.3</version>

            <scope>test</scope>  

       </dependency>

       <!-- https://mvnrepository.com/artifact/com.relevantcodes/extentreports -->

      <dependency>

      <groupId>com.relevantcodes</groupId>

      <artifactId>extentreports</artifactId>

      <version>2.41.2</version>

      </dependency>

      <!-- https://mvnrepository.com/artifact/org.uncommons/reportng -->

      <dependency>

      <groupId>org.uncommons</groupId>

      <artifactId>reportng</artifactId>

      <version>1.1.4</version>

      <scope>test</scope>

      </dependency>

      <!-- https://mvnrepository.com/artifact/com.google.inject/guice -->

     <dependency>

     <groupId>com.google.inject</groupId>

     <artifactId>guice</artifactId>

     <version>4.2.2</version>

     </dependency>

     <!-- https://mvnrepository.com/artifact/org.apache.velocity/velocity -->

     <dependency>

    <groupId>org.apache.velocity</groupId>

    <artifactId>velocity</artifactId>

    <version>1.7</version>

    </dependency>

     

     <!-- https://mvnrepository.com/artifact/log4j/log4j -->

     <dependency>

     <groupId>log4j</groupId>

     <artifactId>log4j</artifactId>

     <version>1.2.17</version>

     </dependency>

     <!-- https://mvnrepository.com/artifact/javax.mail/javax.mail-api -->

     <dependency>

      <groupId>javax.mail</groupId>

      <artifactId>javax.mail-api</artifactId>

      <version>1.6.2</version>

      </dependency>

      <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->

      <dependency>

      <groupId>mysql</groupId>

      <artifactId>mysql-connector-java</artifactId>

      <version>8.0.15</version>

      </dependency>

      <!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->

      <dependency>

      <groupId>org.apache.poi</groupId>

      <artifactId>poi</artifactId>

      <version>4.0.1</version>

      </dependency>

      <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->

      <dependency>

      <groupId>org.apache.poi</groupId>

      <artifactId>poi-ooxml</artifactId>

      <version>4.0.1</version>

      </dependency>

      <!-- https://mvnrepository.com/artifact/dom4j/dom4j -->

      <dependency>

      <groupId>dom4j</groupId>

      <artifactId>dom4j</artifactId>

      <version>1.6.1</version>

      </dependency>

      <!-- https://mvnrepository.com/artifact/org.apache.xmlbeans/xmlbeans -->

      <dependency>

      <groupId>org.apache.xmlbeans</groupId>

      <artifactId>xmlbeans</artifactId>

      <version>3.0.2</version>

      </dependency>

      <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas -->

      <dependency>

      <groupId>org.apache.poi</groupId>

      <artifactId>poi-ooxml-schemas</artifactId>

      <version>4.0.1</version>

      </dependency>

</dependencies>

</project>


Also, I am using a MAC OS. The browser=chrome and testurl=http://www.way2automation.com/angularjs-protractor/banking/#/login are invoked through a config.properties file. The locators are invoked through a Or properties file bmlBTN = div > div:last-child > .btn.btn-primary.btn-lg.


I have also disabled the default TestNG listeners.


Problem Statement : If I do not use System.setProperty("org.uncommons.reportng.escape-output", "false"),the link is displayed in the index.html report. On adding this statement , I am expecting a screenshot but it is not captured.


Mark Collin

unread,
Mar 5, 2019, 4:26:46 AM3/5/19
to Selenium Users
Wow that's a really old library, you may want to look for something newer.  It hasn't been touched for 6 years so it's possible the current version of TestNG has changed slightly.  Anyway if you look at this:


Your POM is not structured in the same way, so I would suggest that as a good place to start.

⇜Krishnan Mahadevan⇝

unread,
Mar 5, 2019, 4:45:39 AM3/5/19
to seleniu...@googlegroups.com
Mark,

We ( the TestNG Dev team ) have formed this repository and are in the process of reviving it. 


Once we release TestNG 7.0.0 we should be able to release this library as well ( under "org.testng" groupId )


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/0183b801-015b-4426-a3ab-76613d6151b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.com/

⇜Krishnan Mahadevan⇝

unread,
Mar 5, 2019, 4:46:32 AM3/5/19
to seleniu...@googlegroups.com
Typo...

Please read "formed" as "forked" 

Mark Collin

unread,
Mar 5, 2019, 5:29:46 AM3/5/19
to Selenium Users
That will be cool moving forward, it doesn't really help the OP right now though unless you have a SNAPSHOT version that they can use hidden away somewhere ;)


On Tuesday, 5 March 2019 09:46:32 UTC, Krishnan Mahadevan wrote:
Typo...

Please read "formed" as "forked" 
Reply all
Reply to author
Forward
0 new messages