• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • Programming Languages
    • Java Tutorials
    • Python Tutorials
    • JavaScript Tutorials
  • Automation Tools and Different Tools
    • Web Automation
      • Selenium with Java
        • Selenium Basic
        • Selenium Advance
        • Selenium Realtime
        • Framework
        • Selenium Interview
        • Selenium Videos
        • Selenium with Docker
      • Selenium with Python
      • WebdriverIO
        • Selenium Webdriver C# Tutorial
      • Cypress
      • Playwright
    • TestNG
    • Cucumber
    • Mobile Automation
      • Appium
    • API Testing
      • Postman
      • Rest Assured
      • SOAPUI
    • testRigor
    • Katalon
    • TestProject
    • Serenity BDD
    • Gradle- Build Tool
    • RPA-UiPath
    • Protractor
    • Windows Automation
  • Automation For Manual Testers
  • Services
  • Online Training
  • Contact us
  • About me
  • Follow us
    • Linkedin
    • Facebook Group
    • Facebook Page
    • Instagram

Automation

Selenium WebDriver tutorial Step by Step

You are here: Home / Extent Report / How To Use Extent Report with Selenium WebDriver and Add Screenshot

How To Use Extent Report with Selenium WebDriver and Add Screenshot

June 10, 2018 by Mukesh Otwani 107 Comments

In this article, I will show you how to use Extent Report with Selenium Webdriver.Report is one of the most important feature of any Automation framework. TestNG already has in-build reporting but it does not look good and attractive. I have been using Extent report in my project since long and it is one of the best reporting.

 

I have already published 2 article of Extent Report 1 and Extent report 2 and recently extent report also has version 3 which is again very attractive.

 

Extent Report Version 3 Part 1

 

Extent Report Version 3 Part 2

Steps to Generate Extent Report with Selenium Webdriver

 

Precondition- You should have Java Project or Maven Project with Selenium.

Step 1-  Start browser and Navigate to http://extentreports.com/  and Click on Community Edition

Step 2-  Click on version 3

Extent Report with Selenium Webdriver

 

Step 3-  Use Maven Dependency- Suggested way to use

If you are using normal Java project then you can download the jar manually and add in project.

<dependency>
    <groupId>com.aventstack</groupId>
    <artifactId>extentreports</artifactId>
    <version>3.1.5</version>
</dependency>

Extent report also maintain very nice documentation which will explain every features.

 

Step 4 – Create Java Program which will generate report.

import java.io.IOException;

import org.testng.annotations.Test;

import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.MediaEntityBuilder;
import com.aventstack.extentreports.Status;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;

public class ExtentReportDemo 
{

	@Test
	public void loginTest() throws IOException
	{    
            // Create Object of ExtentHtmlReporter and provide the path where you want to generate the report 
            // I used (.) in path where represent the current working directory
	    ExtentHtmlReporter reporter=new ExtentHtmlReporter("./Reports/learn_automation1.html");
		
            // Create object of ExtentReports class- This is main class which will create report
	    ExtentReports extent = new ExtentReports();
	    
            // attach the reporter which we created in Step 1
	    extent.attachReporter(reporter);
	    
            // call createTest method and pass the name of TestCase- Based on your requirement
	    ExtentTest logger=extent.createTest("LoginTest");
	    
            // log method will add logs in report and provide the log steps which will come in report
	    logger.log(Status.INFO, "Login to amazon");
	   
	    logger.log(Status.PASS, "Title verified");
	   
            // Flush method will write the test in report- This is mandatory step  
	    extent.flush();
		
            // You can call createTest method multiple times depends on your requirement
            // In our case we are calling twice which will add 2 testcases in our report
	    ExtentTest logger2=extent.createTest("Logoff Test");
	    
	    logger2.log(Status.FAIL, "Title verified");
	    
	    logger2.fail("Failed because of some issues", MediaEntityBuilder.createScreenCaptureFromPath("/Users/mukeshotwani/Desktop/logo.jpg").build());
        
	    logger2.pass("Failed because of some issues", MediaEntityBuilder.createScreenCaptureFromPath("/Users/mukeshotwani/Desktop/logo.jpg").build());

            // This will add another test in report
	    extent.flush();
	    	
	}
	
}

Above code will generate the report in specific directory.

 

 

Scenario  2- Generate Extent Report which will attach Screenshot automatically when Test Failed.

import java.io.IOException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.MediaEntityBuilder;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;

public class ExtentReportDemo2 
{
         // Create global variable which will be used in all method
	 ExtentReports extent;
	 ExtentTest logger;
	 WebDriver driver;
	
        // This code will run before executing any testcase
	@BeforeMethod
	public void setup()
	{
	    ExtentHtmlReporter reporter=new ExtentHtmlReporter("./Reports/learn_automation2.html");
		
	    extent = new ExtentReports();
	    
	    extent.attachReporter(reporter);
	    
	    logger=extent.createTest("LoginTest");
	}

	
        // Actual Test which will start the application and verify the title
	@Test
	public void loginTest() throws IOException
	{
		System.setProperty("webdriver.chrome.driver", "/Users/mukeshotwani/Desktop/chromedriver");
		driver=new ChromeDriver();
		driver.get("http://www.google.com");
		System.out.println("title is "+driver.getTitle());
		Assert.assertTrue(driver.getTitle().contains("Mukesh"));
	}
	
        // This will run after testcase and it will capture screenshot and add in report
	@AfterMethod
	public void tearDown(ITestResult result) throws IOException
	{
		
		if(result.getStatus()==ITestResult.FAILURE)
		{
			String temp=Utility.getScreenshot(driver);
			
			logger.fail(result.getThrowable().getMessage(), MediaEntityBuilder.createScreenCaptureFromPath(temp).build());
		}
		
		extent.flush();
		driver.quit();
		
	}
	
	
}

 

In above code I have used one library which will capture the screenshot and return the path which we have used to pass in report.

public class Utility 
{

	public static String getScreenshot(WebDriver driver)
	{
		TakesScreenshot ts=(TakesScreenshot) driver;
		
		File src=ts.getScreenshotAs(OutputType.FILE);
		
		String path=System.getProperty("user.dir")+"/Screenshot/"+System.currentTimeMillis()+".png";
		
		File destination=new File(path);
		
		try 
		{
			FileUtils.copyFile(src, destination);
		} catch (IOException e) 
		{
			System.out.println("Capture Failed "+e.getMessage());
		}
		
		return path;
	}
	
}

 

In above code I have used one of the feature of TestNG which help us to capture the result after execution.

I have detailed article on this which will explain how to capture screenshot on failure.

Hope you have enjoyed this article and try to implement the same in your project. If you have any doubt or want to discuss anything on this topic then just leave a comment and I will get back to you on this ASAP.

 

Thanks and Have A Nice Day 🙂

Filed Under: Extent Report

Reader Interactions

Comments

  1. Atul Kishor Dubile says

    December 30, 2020 at 10:02 PM

    How to attach fail test case video in extent report.
    Video is generated but how to add that video in extend report?
    Please explain

    Reply
    • Mukesh Otwani says

      December 31, 2020 at 3:16 PM

      Hi Atul,

      You can use extentTestObj.addScreenCast() method available in Extent Report to attach video in Extent Report. This can be found at http://www.extentreports.com/docs/versions/2/java/.

      Reply
    • poobathy says

      March 4, 2021 at 11:37 PM

      Extent report is displayed as plain text with no style sheet any idea why it is displayed like this

      Reply
      • Mukesh Otwani says

        March 5, 2021 at 7:51 PM

        Hi Poobathy,

        Are you running your test execution through Jenkins? If so then check this link

        Reply
        • poobathy says

          March 5, 2021 at 11:01 PM

          Am not executing through Jenkins just through eclipse only
          in eclipse web browser the report has broken UI, because it was worked perfectly before 10 days
          just wondering because of my java update

          Reply
          • Mukesh Otwani says

            March 6, 2021 at 8:29 PM

            Hi Poobathy,

            It doesn’t seem to be Java issue. Have you tried opening same report in different browsers?

  2. Ankit kulhade says

    October 1, 2020 at 11:52 AM

    Hi article is great and really helpful. But what if i want to add runTime data in the extent report. for example user craeted one Bill and now i want to show that bill number to my report weather test has passed of failed. ?

    can we add excel file with the Extent report ?

    can you suggest on this .

    Reply
    • Mukesh Otwani says

      October 1, 2020 at 6:47 PM

      Hi Ankit,

      On step where Bill No. gets generated and becomes visible on screen. Capture that value using element.getText() function then use ExtentTest object to put log into report as below
      logger.log(Status.INFO, “Bill No. generated “+element.getText());

      Reply
  3. sam says

    September 14, 2020 at 6:24 PM

    Hi , I am having maven project for automation .how i can run the test cases in parallel mode.
    Thank you

    Reply
    • Mukesh Otwani says

      September 15, 2020 at 10:33 AM

      Hi Sam,

      Please refer this link https://learn-automation.com/parallel-execution-in-selenium/

      Reply
  4. selenium_tester says

    April 20, 2020 at 2:55 AM

    Hi Mukesh,
    Your videos are very informative.
    I am following your videos.
    1. I have been able to capture the screenshot for the failed test, but the image loaded on the extent report is just like a small icon.
    If I click on the icon, then the image becomes bigger.
    Can you suggest why?
    2. could you please make a video, in which integrate the Extent report into the framework but without using testng.
    for eg: creating extent report as a static method in some other .java file and calling it as a function, whenever the test fails
    -The .java file then could be a part of utilities package in the framework and not a part of base class
    – the extent Utility.java class file should include methods like: setUp Extentfile, OntestSuccess ,OnTestFailure , ontestSkip method , alongwith the screenshot method

    Reply
    • Mukesh Otwani says

      April 22, 2020 at 1:47 PM

      Hi Tester,

      Have you tried to open the report in different web browsers?
      Your second point has mixed requirements. First without testng, it becomes difficult to manage and configure test execution. Selection of report object as static depends on requirement.

      Reply
  5. Mohammed Nasir Uddin says

    April 15, 2020 at 8:19 AM

    Hi Mukesh
    I am new in this field. I like your video very much because every thing you start from scratch and you are very detail oriented. Your video ‘Integrate Extent Report and Logs in Framework’ is also very good. in this video, it very difficult to connect step by step. It would be more better, if you had started every thing from scratch.

    Thanks.

    Reply
    • Mukesh Otwani says

      April 15, 2020 at 9:33 AM

      Hi Nasir,

      Please go through my youtube playlist https://www.youtube.com/c/Mukeshotwani

      Also, you can visit the following links
      http://learn-automation.com/selenium-webdriver-tutorial-for-beginners/
      http://learn-automation.com/advance-selenium-webdriver-tutorials/
      http://learn-automation.com/jenkins-with-selenium/

      Reply
  6. KESHAV says

    March 5, 2020 at 4:46 PM

    Hi Mukesh here is my baseclass class which I am using for creating extent reports.

    package com.Hybrid_framework.BaseSetup;

    import com.Hybrid_framework.Utilities.CustomUtility;
    import com.Hybrid_framework.Utilities.Properties_reader;
    import com.aventstack.extentreports.ExtentReports;
    import com.aventstack.extentreports.ExtentTest;
    import com.aventstack.extentreports.MediaEntityBuilder;
    import com.aventstack.extentreports.Status;
    import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
    import com.aventstack.extentreports.reporter.configuration.Theme;
    import org.openqa.selenium.WebDriver;
    import org.testng.ITestResult;
    import org.testng.annotations.*;
    import java.io.IOException;

    public class Baseclass {

    public ExtentHtmlReporter htmlreporter;
    public ExtentReports extent;
    public ExtentTest testlogger;
    public WebDriver driver;

    @BeforeSuite
    public void setReport(){

    htmlreporter = new ExtentHtmlReporter(System.getProperty(“user.dir”)+”/ExecutionReports/extent-“+CustomUtility.getCurrentDateTime()+”.html”);
    htmlreporter.config().setDocumentTitle(“Automation Report”); // Tile of report
    htmlreporter.config().setReportName(“Functional Testing”); // Name of the report
    htmlreporter.config().setTheme(Theme.STANDARD);

    extent = new ExtentReports();
    extent.attachReporter(htmlreporter);
    extent.setSystemInfo(“User name”,System.getProperty(“user.name”));
    extent.setSystemInfo(“Time Zone”, System.getProperty(“user.timezone”));
    extent.setSystemInfo(“User Location”, System.getProperty(“user.country”));
    extent.setSystemInfo(“OS name”, System.getProperty(“os.name”));
    extent.setSystemInfo(“OS version”, System.getProperty(“os.version”));
    extent.setSystemInfo(“JDK version”,System.getProperty(“java.version”));
    extent.setSystemInfo(“Maven version”,Properties_reader.fetchPropertyValue(“Maven”));
    extent.setSystemInfo(“Selenium version”,Properties_reader.fetchPropertyValue(“SeleniumVersion”));
    }

    @AfterSuite
    public void endReport(){
    extent.flush();
    }

    @BeforeTest
    public void setupEnv(){
    driver= BrowserSetup.LaunchBrowser(driver, Properties_reader.fetchPropertyValue(“Browser”),Properties_reader.fetchPropertyValue(“Url”));
    }

    @AfterTest
    public void closeEnv(){
    BrowserSetup.Teardown(driver);
    }

    @AfterMethod
    public void evaluateStatus(ITestResult result) throws IOException {

    if (result.getStatus() == ITestResult.FAILURE) {

    testlogger.log(Status.FAIL, “TEST CASE FAILED IS ” + result.getName()); // to add name in extent report
    testlogger.log(Status.FAIL, “TEST CASE ERROR IS ” + result.getThrowable());
    String screenshotpath=CustomUtility.captureScreenshot(driver,result.getName());
    testlogger.fail(“Test case has failed screenshot is below “, MediaEntityBuilder.createScreenCaptureFromPath(screenshotpath).build());

    System.out.println(screenshotpath);
    }
    else if (result.getStatus() == ITestResult.SUCCESS) {
    testlogger.log(Status.PASS, “Test Case PASSED IS ” + result.getName());
    }
    }
    }

    and here is the class which contains the screenshot method
    public class CustomUtility {

    public static String captureScreenshot(WebDriver driver, String screenshotName) {

    TakesScreenshot ts=(TakesScreenshot)driver;
    File src=ts.getScreenshotAs(OutputType.FILE);
    String dest=System.getProperty(“user.dir”)+”\\Screenshots\\” +screenshotName+CustomUtility.getCurrentDateTime() +”.png”;
    File finalDestinaton=new File(dest);
    try {
    FileHandler.copy(src, finalDestinaton);
    }catch (Exception e){
    System.out.println(e.getMessage());
    }
    return dest;
    }

    public static String getCurrentDateTime(){
    DateFormat dateFormat = new SimpleDateFormat(“dd-mm-yyyy-h-m-s”);
    Date date = new Date();
    return dateFormat.format(date);
    }
    }

    I can generate the report and do the logging easily but the only issue that despite of several efforts I am not able to find out the reason why Screenshot is not getting attached in report, Actually in place of screenshot I am getting broken image in the report.Please go through my code and let me know whats wrong as I have spent entire day in this.

    Reply
    • Mukesh Otwani says

      March 10, 2020 at 2:50 PM

      Hi Keshav, are you running this test via Jenkins? If yes, then you can go screenshot with bas64 and then attach the same.

      Reply
      • Keshav Dwivedi says

        March 12, 2020 at 12:51 PM

        I am not running it via Jenkins I am directly executing via Maven but still screenshot is not there even though report is being formed similar issue I have encountered in extent report 4 version

        Reply
        • Mukesh Otwani says

          March 12, 2020 at 2:06 PM

          Hi Keshav,

          In your Extent report, do Inspect Element for the image which is not visible and check the actual image path

          Reply
    • Smita says

      December 1, 2020 at 2:12 PM

      Hi Keshav,
      Is your issue resolved?
      I ran your code on my device and found that the ‘Screenshots’ folder was not there, so I was also getting a broken image.
      So I just created a folder named ‘Screenshots’ under my project home directory and it worked successfully and captured failed screenshot.

      Reply
  7. maqdoom says

    March 4, 2020 at 4:30 PM

    Hi mukesh,

    I am getting this exception

    FAILED CONFIGURATION: @AfterTest tearDown
    java.lang.IllegalArgumentException: wrong number of arguments

    how to overcome this?

    Reply
    • Mukesh Otwani says

      March 4, 2020 at 5:34 PM

      Hi Maqdoom,

      This is a basic java related issue. Kindly check number of parameters which you are passing in tearDown method

      Reply
      • maqdoom says

        March 4, 2020 at 10:48 PM

        Hi mukesh,

        this is the method i am try to run. but it is showing the same exception. plz help me out.

        @AfterTest
        public void tearDown(ITestResult result) throws IOException
        {
        if (result.getStatus()==ITestResult.FAILURE)
        {
        String temp = extent_Report.Utility.getScreenshot(driver);

        logger.fail(result.getThrowable().getMessage(), MediaEntityBuilder.createScreenCaptureFromPath(temp).build());
        }
        extent.flush();
        driver.quit();

        }
        }

        Reply
        • Mukesh Otwani says

          March 5, 2020 at 4:01 PM

          Hi Maqdoom,

          Use ITestResult in AfterMethod annotated method

          Reply
  8. ALAK DUTTA says

    December 25, 2019 at 1:08 AM

    Hi, Mukesh
    Your videos are very helpful. Can you please let me know how to get the all data of the passed/failed test cases in the extent report. For example I want to print all the options in the dropdown list and present it in the extent report.

    Reply
    • Mukesh Otwani says

      December 28, 2019 at 8:13 AM

      Hi Alak,

      As you mentioned about drop down case, use getAllOptions from Select class. Bring those values or text into extent report using ExtentTest object.

      Reply
  9. Mubarak says

    December 15, 2019 at 10:52 PM

    Hi

    can you a post using the above in POM please.

    thanks

    Reply
    • Mukesh Otwani says

      December 16, 2019 at 10:21 AM

      Hi Mubarak,

      I’ll post it soon…

      Reply
  10. Raki says

    October 31, 2019 at 12:59 AM

    HI Mukesh,

    Can you show how to implement extent reports for parallel testing..? I don’t see any online help on extent reports with parallel testing and relying on you as usual.

    Reply
    • Mukesh Otwani says

      October 31, 2019 at 1:27 AM

      Hi Raki,

      I’ll post it soon…:)

      Reply
  11. Atish Garg says

    August 26, 2019 at 3:59 PM

    Hello Mukesh. I want to override the extent report status (left side) . As some time due to UI ,test failed and extent report mark it failed , but on retry , the test passed . Still extent report shows the test passed . is this possible

    Reply
    • Mukesh Otwani says

      August 26, 2019 at 5:30 PM

      Hi Atish,

      Extent report is configurable in many possible ways. If you look at this http://extentreports.com/docs/javadoc/com/aventstack/extentreports/Status.html then you will multiple status for logs. ExtentTest logger cannot identify failure in test script, It depends on what status log we provide at point of failure. Whenever log status of Fail/Error/Fatal comes into report then only it will mark test as failure.

      Reply
  12. Himanshu Soni says

    August 9, 2019 at 1:49 PM

    hi Mukesh,
    I want to implement ExtentReport at suite level and it should generate a single report. Is this feature possible through community version?

    Reply
    • Mukesh Otwani says

      August 9, 2019 at 2:48 PM

      Hi Himanshu,

      Yes, it is possible with community version of Extent Report.

      Reply
  13. rohit says

    June 4, 2019 at 4:09 PM

    cant see extent report on intellij with above code
    path curDir+”\\learn_automation1.html”);

    Reply
    • Mukesh Otwani says

      June 6, 2019 at 9:50 PM

      Hi Rohit,

      Kindly check your report path as it shouldn’t depend on IDE.

      Reply
  14. Sruthi says

    May 8, 2019 at 7:40 PM

    Hi Mukesh,

    ExtentHtmlReporter is not displayed in the eclipse. I tried the “Project Root folder -> Properties -> Maven -> Update Project -> Tick all checkboxes at bottom -> OK” as suggested in one of your responses but no luck.
    ‘
    I am using extent reports 4

    Reply
    • Mukesh Otwani says

      May 8, 2019 at 8:19 PM

      Hi Sruthi,

      I would recommend you to go through their documentation http://extentreports.com/docs/versions/4/java/

      Reply
  15. Shailaja nare says

    May 1, 2019 at 4:11 PM

    Hi Mukesh,
    I have added dependency in pom .xml file but some how it’s not working
    ExtentHtmlReporter class is not visible in eclipse.and eclipse is not giving default suggestions to add it..

    Reply
    • Mukesh Otwani says

      May 1, 2019 at 11:41 PM

      Hi Shailaja,

      Do right click on Project Root folder -> Properties -> Maven -> Update Project -> Tick all checkboxes at bottom -> OK
      After above, restart eclipse.

      Reply
  16. William Gomes Soares says

    May 1, 2019 at 12:56 AM

    How did you create the ITestResult class?

    Reply
    • Mukesh Otwani says

      May 1, 2019 at 12:53 PM

      Hi William ITest in interface from TestNG library

      Reply
  17. Pratik says

    April 13, 2019 at 4:42 PM

    HI Mukesh ,
    I have implemented above code by creating extent report in separate class in main folder , and have kept the tests in test folder and using the extent feature by inheritance as : public class testone extends extendedreport.

    The issue now is for screenshot I need to again define driver in extent report , hence it capture a blank screen , as new driver is started .
    How to fix this , as ideally we dont want to write extent report code for each test separately

    Reply
    • Mukesh Otwani says

      April 13, 2019 at 7:49 PM

      Hi Pratik,

      In this case, you need to use multi level inheritance so that you can access same driver object to your testone class.

      Reply
  18. Sudha says

    April 6, 2019 at 12:31 PM

    Hi Mukesh,

    Thanks for sharing such wonderful information on extent report. I have implemented extent report in my framework. Html report is getting generated and all the logs are present inside it. But the report is not displayed in proper format, its displayed as plain text. And pie chart is not displayed. I have tried opening the report in chrome, IE and Firefox but its same in all the browsers. Could you please help me here.

    Regards,
    Sudha

    Reply
    • Mukesh Otwani says

      April 6, 2019 at 1:50 PM

      Hi Sudha,

      Which version of Extent report is in your project?

      Reply
      • Sudha says

        April 7, 2019 at 1:48 PM

        Hi Mukesh, I am using 2.41.2.

        Reply
        • Mukesh Otwani says

          April 7, 2019 at 4:17 PM

          Hi Sudha,

          Selenium 2.41.x is quite old version released in March, 2014. I would recommend you to use latest 3.141.59

          Reply
    • Bindu says

      October 29, 2019 at 12:13 PM

      Hi Sudha/ Mukesh,

      Is your issue with report format resolved.?
      If so, could you let me know the steps followed.. even I am facing same issue.

      Reply
      • Mukesh Otwani says

        October 30, 2019 at 4:40 PM

        Hi Bindu,

        HTML report coming in plan text format usually happens when CSS is not rendered properly on Web browser. It would be better if you use last release of version 3 of extent report which is 3.1.5

        Reply
  19. Dharani says

    April 2, 2019 at 2:27 PM

    Is there any options to add video recording in extent report

    Reply
    • Mukesh Otwani says

      April 2, 2019 at 9:30 PM

      Hi Dharani,

      I never tried this scenario but you can have look on these links
      1. https://www.youtube.com/watch?v=jERN4Pf2aKc
      2. https://www.youtube.com/watch?v=AoHs1atsLlg

      Reply
  20. Teja says

    March 27, 2019 at 3:39 PM

    HI mukesh, Here i am getting error as configuration failure as

    [RemoteTestNG] detected TestNG version 6.14.3
    FAILED CONFIGURATION: @AfterMethod tearDown([TestResult name=loginTest status=FAILURE Method=BrandCreation.loginTest()[pri:0, instance:foodie.BrandCreation@42dafa95] output={null}])
    java.lang.NullPointerException
    at foodie.Utility.getScreenshot(Utility.java:18)
    at foodie.BrandCreation.tearDown(BrandCreation.java:156)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

    Reply
    • Mukesh Otwani says

      March 27, 2019 at 6:53 PM

      Hi Teja,

      Kindly debug your code at these below mentioned lines
      at foodie.Utility.getScreenshot(Utility.java:18)
      at foodie.BrandCreation.tearDown(BrandCreation.java:156)

      Reply
    • bhushan pawar says

      October 24, 2019 at 11:43 PM

      Hi Mukesh,
      Can I use Extent report without Testng and selenium, in desktop based application, I am using Java

      Reply
      • Mukesh Otwani says

        October 25, 2019 at 12:07 AM

        Hi Bhushan,

        Yes, Extent Report can be implemented without using TestNG and Selenium

        Reply
  21. Vijaya says

    March 26, 2019 at 2:16 PM

    Hi Mukesh,
    I am working with the Extent report generation. I have a GetResult methode in “A” Class and i am calling that methde from Class “B”.But getting NULLPointerException at the if(result.getStatus() == ITestResult.FAILURE) statement from getresult method. How to handle this

    Reply
    • Mukesh Otwani says

      March 27, 2019 at 8:28 PM

      Hi Vijaya,

      ITestResult reference variable(i.e. result) brings @Test annotated method result. Now if you call this method from some other class then how will it refer your actual test method.
      Are you inheriting class A to B?

      Reply
      • Vijaya says

        March 28, 2019 at 4:45 PM

        I have created the object of class “A” in class “B” and calling the methode by lp.getResult(result);

        Reply
        • Mukesh Otwani says

          March 28, 2019 at 6:54 PM

          Hi Vijaya,

          You have to inherit class A to class B. The way you mentioned won’t work.

          Reply
          • Vijaya says

            April 5, 2019 at 10:21 AM

            Yes Mukesh. Issue solved. Thank you.

          • Mukesh Otwani says

            April 5, 2019 at 1:12 PM

            Hi Vijaya,

            Good…:)

  22. Abdul says

    March 26, 2019 at 7:29 AM

    Hi Mukesh,

    can you please make a video for how to use data provider with extent report, and also parallel execution. thank you so much.

    Reply
    • Mukesh Otwani says

      March 26, 2019 at 10:51 AM

      Hi Abdul,

      Here is the link for testng dataProvider http://learn-automation.com/data-driven-framework-in-selenium-webdriver/. In dataprovider looping mechanism, you can call ExtentTest object for logs into report.
      I’ll post extent report with parallel execution soon.

      Reply
  23. Sumanth says

    March 25, 2019 at 6:25 PM

    Hi Mukesh,

    How to add the time stamp to extent report in BDD-Cucumber framework.
    So that, for each execution new report should generate based on time stamp.

    Thnaks
    Sumanth

    Reply
    • Mukesh Otwani says

      March 25, 2019 at 10:27 PM

      Hi Sumanth,

      You can use SimpleDateFormat library and generate current date and time in your required format and add as either prefix or suffix to report name.

      Reply
      • Sumanth says

        March 26, 2019 at 10:57 AM

        I have tried, but it didnt work.
        The TestRunner.java class is below

        @RunWith(Cucumber.class)

        @CucumberOptions(
        features = {“src/test/resources/CommonElements/CommonPgDisplay.feature”},// path of the feature file
        glue = {“com.endnote.stepDefinition”}, // path of the step definition
        format = {“pretty”, “json:target/cucumber-report.json”, “junit:target/cucumber-junit-report/cuc.xml”},//re sults format
        monochrome = true, //display the console output in a proper readable format
        strict = true, // it will fail the execution if there are any undefined steps(Step definition) are there
        dryRun=false, // to check the mapping between feature file and Step definition file
        tags = {“@test”},// for group run.., represent ORed operator and ANDed operator
        plugin ={“com.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/report.htm”,}// path of the extent report
        )

        Thanks’
        Sumant

        Reply
        • Mukesh Otwani says

          March 27, 2019 at 8:43 PM

          Hi Sumanth,

          Call your required method as mentioned below…
          plugin ={“com.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/”+<method for timestamp>+”report.html”,}

          Reply
      • Sumanth says

        March 27, 2019 at 6:22 PM

        in which class need to add SimpleDataFormat library

        Reply
        • Mukesh Otwani says

          March 27, 2019 at 8:14 PM

          Hi Sumanth,

          You can this method in utility kind of class and invoke this method while creation of report name.

          Reply
  24. Hema says

    September 27, 2018 at 3:49 PM

    Hi sir,
    I have tried extent reports in (GEB, SPOCK, GROOVY) maven project . But I’m unable to create report in report package. Could u please help me

    Reply
    • Mukesh Otwani says

      September 27, 2018 at 10:12 PM

      Hi Hema,

      Kindly check official documentation of Extent Reports as they didn’t mention any support for Geb, Spock & Groovy. If somebody has forked it modify then refer corresponding docs.

      Reply
  25. neeraj jain says

    September 10, 2018 at 7:04 PM

    Hello Mukesh,
    You Are doing good Job.
    would you please confirm me that these videos are still relevant as i am afraid that some new version (extent report and other tools)has changed this .. please confirm. also could you please upload some latest video on selenium framework and mobile automation.

    Reply
    • Mukesh Otwani says

      September 12, 2018 at 9:17 AM

      Hi Neeraj,

      Whatever videos/topics, I’ve posted are always relevant. Only thing is, being open source Selenium, Extent Report API, Jenkins..etc keep on updating frequently but that doesn’t means old versions doesn’t work. New versions comes with enhanced features..thats it. Old versions are available and you can use it anytime. Only thing which you need to understand is, what is your requirement…:)

      For appium stuffs, I’ll upload videos soon..:)

      Reply
  26. Dipak Ingale says

    September 4, 2018 at 3:46 PM

    Hi Mukesh,
    I am trying to send the Extent Report which is generated using Extent Report 3.0 version on other machine via email. I am able to open the mail on other machine but the attached screenshot src is showing as local machine address. Can you please let me know how to tackle this issue so that I can see the images on other machine as well.
    I am trying to store the screenshot using system.getProperty(“user.dir”) method.

    Reply
    • Mukesh Otwani says

      September 12, 2018 at 8:44 PM

      Hi Dipak,

      Extent report supports relative path of file but if you want to see those images from other inside/outside your existing network then all screenshots have to be saved on machine which can act as web server. Because those screenshots are local to that machine which is not available on network(this is a case of viewing a file from other machine)

      Reply
  27. kohith says

    August 29, 2018 at 3:54 PM

    can we customize the error message in the extent report when the test script got failed. Currently the console output is getting attached to the error step def line in report. — #cucumberTest #ExtentReport

    Reply
    • Mukesh Otwani says

      September 9, 2018 at 9:34 PM

      Hi Kohith,

      Please refer this link https://github.com/email2vimalraj/CucumberExtentReporter

      Reply
  28. ashish says

    August 22, 2018 at 12:22 AM

    how can we use a single logger for multiple test cases?

    Reply
    • Mukesh Otwani says

      August 22, 2018 at 9:20 AM

      Hi Ashish,

      Inside baseclass, create object of logger and extend it all your test cases.

      Reply
  29. mahendra says

    July 24, 2018 at 3:59 PM

    Hi mukesh,
    i m mahendra i need one information about Selenium.how to download Jenkins &install and how to run programe in Jenkins.

    thanks in advance,
    mahendra

    Reply
    • Mukesh Otwani says

      July 25, 2018 at 8:56 AM

      Hi Mahendra,

      Please check this link http://learn-automation.com/jenkins-with-selenium/

      Reply
  30. Bhavya says

    July 20, 2018 at 10:44 AM

    Hi Mukesh,
    How to run the selenium scripts in multiple Chrome browsers in the same machine using Testng.
    Note: Same browser, same machine
    Thanks in Advance,
    Bhavya

    Reply
    • Mukesh Otwani says

      July 20, 2018 at 5:54 PM

      Hi Bhavya,

      Please check this link http://learn-automation.com/cross-browser-testing-using-selenium-webdriver/

      Reply
  31. Pramod says

    July 16, 2018 at 6:30 PM

    Hello Mukesh,

    I am getting an error.
    java.lang.UnsupportedClassVersionError: com/aventstack/extentreports
    Plz help

    Reply
    • Mukesh Otwani says

      July 17, 2018 at 1:27 AM

      Hi Pramod,

      Which version of extent report you have used?

      Reply
  32. Mayank Shabani says

    July 13, 2018 at 2:25 PM

    Hi Mukesh,

    Can you help me with one question?
    If I want to send the extentreport to my team via Email, how would I be able to do so?

    Reply
    • Mukesh Otwani says

      July 16, 2018 at 10:28 AM

      Hi Mayank,

      I would recommend you to send email link instead of whole email. You can achieve this by Commons Email API https://www.youtube.com/watch?v=qGq9K85mGyA
      And if you are using Jenkins then refer this link https://www.youtube.com/watch?v=4PTYVIaBT1Q

      Reply
  33. kumar says

    July 5, 2018 at 9:05 PM

    Hi Mukesh,

    We are using Cucumber reports which are more good and attractive. So this Selenium Webdriver.Report is similar to cucumber reports right?

    Reply
    • Mukesh Otwani says

      July 6, 2018 at 10:09 AM

      Hi Kumar,

      May I know which Selenium WebDriver report are you looking for?

      Reply
  34. Faizan Farooq Mamji says

    June 27, 2018 at 9:03 PM

    Hi Mukesh,
    Its really helpful 🙂

    Reply
    • Mukesh Otwani says

      June 28, 2018 at 9:27 AM

      Hi Faizan,

      Thanks for your comments…:)

      Reply
  35. Ram says

    June 26, 2018 at 5:17 PM

    Hi Mukesh,
    Can you please make some blog for Cucumber & Protractor integration.
    Ex- Angular application where BDD needs to be implemented

    Reply
    • Mukesh Otwani says

      June 27, 2018 at 9:33 AM

      Hi Ram,

      As of now, I haven’t planned for this hut in coming days, will do it…:)

      Reply
  36. Ishita Shah says

    June 22, 2018 at 12:40 PM

    Is their provision in Extent Report, to get back on Parent Node while using ChildNode.
    Example: http://prntscr.com/jxx4gf

    Reply
    • Mukesh Otwani says

      June 22, 2018 at 3:23 PM

      Hi Ishita,

      I think you may need to edit existing code. Look at below mentioned code

      ExtentTest parentTest = extent.createTest(“MyFirstTest”);
      ExtentTest childTest = parentTest.createNode(“MyFirstChildTest”);
      childTest.pass(“details”);

      Reply
  37. RANJAN V says

    June 21, 2018 at 10:28 AM

    How to Run Cucumber as Maven Test?

    Reply
    • Mukesh Otwani says

      June 22, 2018 at 9:03 AM

      Hi Ranjan,

      Please check this link https://www.youtube.com/watch?v=4cF1Q7CISSE&list=

      Reply
      • RANJAN V says

        June 22, 2018 at 10:00 AM

        Hi Mukesh,

        Thanks a lot Mukesh.Finally issue got resolved and now I am able to Run Cucumber as Maven Test.

        Reply
        • Mukesh Otwani says

          June 22, 2018 at 3:11 PM

          Great…:)

          Reply
  38. Sonali says

    June 19, 2018 at 2:40 PM

    Hi Mukesh,
    This is regarding write excel code in selenium using apache poi.
    I am able to write data excel file where in excel file already have value.

    but in blank excel file i am getting output value as null. Please suggest how to write data in blank excel sheet

    Reply
    • Mukesh Otwani says

      June 19, 2018 at 2:57 PM

      Hi Sonali,

      May be you are missing something in your code. Please check this link http://learn-automation.com/read-and-write-excel-files-in-selenium/

      Reply
  39. Arjit Kathuria says

    June 18, 2018 at 10:17 PM

    Thank you my screenshot problem is solved now.

    Reply
    • Mukesh Otwani says

      June 19, 2018 at 9:47 AM

      Great…:)

      Reply
  40. RANJAN V says

    June 11, 2018 at 12:49 PM

    Hi Mukesh,
    How to set Environment Variable path for Maven in Mac?

    Reply
    • Mukesh Otwani says

      June 12, 2018 at 3:50 PM

      Hi Ranjan,

      Please refer this link

      Reply
      • RANJAN V says

        June 21, 2018 at 5:30 PM

        Thanks Mukesh.

        Reply
        • Mukesh Otwani says

          June 22, 2018 at 8:51 AM

          Hi Ranjan,

          You are Welcome…:)

          Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Free Selenium Videos

https://www.youtube.com/watch?v=w_iPCT1ETO4

Search topic

Top Posts & Pages

  • Selenium Webdriver tutorial for beginners
  • How To Fix Eclipse Autocomplete Or Code Suggestion In Eclipse
  • Selenium Webdriver C# Tutorial
  • WHAT ARE YOUR EXPECTATIONS FROM US?

Stay connected via Facebook

Stay connected via Facebook

Archives

Footer

Categories

Recent Post

  • API Testing Using Postman And RestAssured
  • Disable Personalise Your Web Experience Microsoft Edge Prompt In Selenium
  • How To Fix Error: No tests found In Playwright
  • How To Fix Eclipse Autocomplete Or Code Suggestion In Eclipse
  • Best and easy way to Group test cases in selenium

Top Posts & Pages

  • Selenium Webdriver tutorial for beginners
  • How To Fix Eclipse Autocomplete Or Code Suggestion In Eclipse
  • Selenium Webdriver C# Tutorial
  • WHAT ARE YOUR EXPECTATIONS FROM US?