Nice HTML report using WebDriver

7,997 views
Skip to first unread message

Corbellini

unread,
Aug 14, 2012, 5:25:55 PM8/14/12
to seleniu...@googlegroups.com, Anderson Corbellini
Hi Guys!

I am finding some solution to have a nice HTML report like the LoggingSelenium in the Selenium WebDriver.

I have tested the EventFiringWebDriver, but it didn''t report all the elements, or I can be doing some mistakes...

For example ... Reporting the following commands:

driver.get(baseUrl);
driver.findElement(By.name("vt_user")).sendKeys("Test");
driver.findElement(By.name("vt_pass")).sendKeys("Test");
driver.findElement(By.xpath("//div/table/tbody/tr[4]/td[2]/a/img")).click();

Is there some way to get these events and add in a HTML report?

Any suggestions would be appreciated... :-)

Thanks in advance.

Shaba K

unread,
Aug 15, 2012, 5:33:09 AM8/15/12
to seleniu...@googlegroups.com
So do you say that LoggingSelenium works well with WebDriver too.

Is there a equivalent of that for C#

cheers,
s


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/YfeXzJ7eIvoJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

PeterJef...@hotmail.co.uk

unread,
Aug 15, 2012, 5:37:32 AM8/15/12
to seleniu...@googlegroups.com, Anderson Corbellini

EventFiringWebDriver will only trigeer your methods from events in the application page.

Going to a URL and finding elements on a page are WebDriver only functionlaity that will not trigger any events on the currently loaded application, so you would need to write entries in your logs separately those actions.

Shaba K

unread,
Aug 15, 2012, 6:25:16 AM8/15/12
to seleniu...@googlegroups.com
Are you talking about WebDriverEventListener

I don't see an equivalent of it for c#

cheers,
s

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/SgJyydHEdQUJ.

Shaba K

unread,
Aug 15, 2012, 6:26:40 AM8/15/12
to seleniu...@googlegroups.com
Ooops it is indeed  EventFiringWebDriver 

Corbellini

unread,
Aug 15, 2012, 10:04:14 AM8/15/12
to seleniu...@googlegroups.com
oops Shaba... sorry for my mistake!

I say that LoggingSelenium works well with Selenium 1 (RC)... I am finding something to the Selenium WebDriver...

The LoggingSelenium had a nice HTML report...

Guys... Is there a HTML report like this to the Selenium WebDriver?

Thanks in advance.

Oscar Rieken

unread,
Aug 15, 2012, 10:35:20 AM8/15/12
to seleniu...@googlegroups.com
what are you using for your tests? most testing frameworks have built in report generations

To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/J6IfuaCWgPgJ.

Shaba K

unread,
Aug 15, 2012, 10:43:37 AM8/15/12
to seleniu...@googlegroups.com
he is talking abt logging reports 

Corbellini

unread,
Aug 15, 2012, 11:40:23 AM8/15/12
to seleniu...@googlegroups.com
That's it... I am talking about Logging reports...

I am using Selenium WebDriver and JUnit... I am trying to find something like LoggingSelenium, because it has a detailed report, but this LoggingSelenium doesn't work in the WebDriver...


Any suggestions would be appreciated... :-)

Thanks in advance. 

Edwolb

unread,
Aug 15, 2012, 3:39:17 PM8/15/12
to seleniu...@googlegroups.com
I'm not sure if its exactly the same, but ReportNG is a nice looking HTML report for TestNG.  Not sure if there's an equivalent for JUnit, but in general what I've found is that events do not log themselves, you need to manually log steps along the way.  We've gotten our framework to the point where our test libraries do the logging for us, and our test classes just call the test libraries, which is very helpful.

--
Chris

Shaba K

unread,
Aug 15, 2012, 5:25:28 PM8/15/12
to seleniu...@googlegroups.com
I stumbled upon

WebDriverEventListener but am not sure how logging is going to occur for action classes.

cheers,
s

To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/_516lCR1S4EJ.

Corbellini

unread,
Aug 15, 2012, 6:07:58 PM8/15/12
to seleniu...@googlegroups.com
I dont know... I need a HTML report detailed like this in the Selenium WebDriver...



I have tried TestNG, but it is not a nice report...

I will study this WebDriverEventListener...

Thanks in advance.

Corbellini

unread,
Aug 15, 2012, 6:12:33 PM8/15/12
to seleniu...@googlegroups.com
oops... I forgot to add the example report detailed...


Any suggestions would be appreciated... :-)

Thanks in advance.

report.PNG

Peter Gale

unread,
Aug 15, 2012, 6:16:12 PM8/15/12
to Selenium Users
Write your own?


Date: Wed, 15 Aug 2012 15:12:33 -0700
From: corbel...@gmail.com
To: seleniu...@googlegroups.com
Subject: Re: [selenium-users] Nice HTML report using WebDriver
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/XqRLCrtriDgJ.

Corbellini

unread,
Aug 15, 2012, 7:07:08 PM8/15/12
to seleniu...@googlegroups.com
Yes... That's it...

I have searched about HTML report detailed to Selenium WebDriver, but I didn't find anything... :-(

I think I will need to create a custom HTML report, but I don't know what is the class that I can listen all the elements of the WebDriver...for example:

driver.findElement(By.name("username")).sendKeys("blablabla");


On this example above... I would like to report the command (sendKeys), value added (blablabla) and status (PASS/FAIL)...

Shaba say WebDriverEventListener can listen these actions... I will search about it...


Thanks in advance.

Corbellini

unread,
Aug 16, 2012, 7:07:40 AM8/16/12
to seleniu...@googlegroups.com
Thanks Alister for your replay!

I have tested the ReportNG and it doesn't have a report detailed.... I would like to have a report like this LoggingSelenium to WebDriver.

On Wednesday, August 15, 2012 7:37:49 PM UTC-3, ALISTER ERNEST wrote:
Corbellini,

Not sure if this will help, but I stumbled across a very simple implementation of ReportNG here - http://selenium2test.blogspot.com/2012/03/reportng-selenium.html 

Now, I don't know what is the equivalent for Junit, but why not give this a try?

- Alister

Shaba K

unread,
Aug 16, 2012, 7:18:19 AM8/16/12
to seleniu...@googlegroups.com
I think you are looking at a step by step logging of  errors/info/debug 

Just like the one we get from webserver.

Am after the same for c#

cheers,
s

To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/F0ZV5qu5Z-YJ.

Corbellini

unread,
Aug 16, 2012, 7:53:13 AM8/16/12
to seleniu...@googlegroups.com
That's it Shaba... :-) a step by step report getting all actions.

I don't know how I can do that...

I am downloading the selenium code now to understand it better.

Anyone has already made a step by step report to WebDriver?


Any suggestions would be appreciated... :-)

Thanks in advance.

Oscar Rieken

unread,
Aug 16, 2012, 8:10:34 AM8/16/12
to seleniu...@googlegroups.com
ok so I guess now I will ask why do you need logging at such a detailed level 
perhaps you just need to know that each step in your scenarios is passing 

maybe you should look into something like jbehave or cucumber-jvm but I still woulding go to that detail to report that each send key sent the keys successfully since I am not testing webdriver and how it works.

To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/2g7oYsVz88gJ.

Shaba K

unread,
Aug 16, 2012, 8:34:40 AM8/16/12
to seleniu...@googlegroups.com

Corbellini

unread,
Aug 16, 2012, 8:48:43 AM8/16/12
to seleniu...@googlegroups.com
Thanks Oscar for your replay! :-)

That is the reason why a report detailed to facilitate identifying which point failed... and where we are in the test...


Thanks in advance.

Corbellini

unread,
Aug 16, 2012, 8:51:09 AM8/16/12
to seleniu...@googlegroups.com
Thanks Shaba... I will look that...

qualityworld

unread,
Aug 16, 2012, 2:56:23 PM8/16/12
to seleniu...@googlegroups.com
I Use Ant Junitreport to create my html reports. A detailed log report was included as part of this report in Selenium I RC. Using the same Ant Commands with webdriver, I get the same basic HTML report but the detailed log reports are not created or linked when using webdriver. I used these detailed logs for debugging sometimes and they were very useful. Too bad we lost this functionality. I looked for a solution for a while but gave up.

Anderson Corbellini

unread,
Aug 16, 2012, 11:43:49 PM8/16/12
to seleniu...@googlegroups.com
I am looking for a HTML report detailed like this LoggingSelenium ... Until now I didn't find anything, but I won't give up... :-)

I know we do not have frameworks that report this step by step on Selenium WebDriver, so I'm researching to develop one...

If anyone has any more solution please reply in this thread...

Thanks in advance

To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/hcMOG92RreMJ.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--

Anderson Corbellini
Porto Alegre, Rio Grande do Sul, Brazil
E-mail: corbel...@gmail.com

Mike Riley

unread,
Aug 17, 2012, 1:35:44 PM8/17/12
to seleniu...@googlegroups.com
TestNG does a fair job and you can enhance it with ReportNG.

Mike

Anderson Corbellini

unread,
Aug 17, 2012, 8:23:36 PM8/17/12
to seleniu...@googlegroups.com
Hi Mike!

Can I have a HTML report (step by step) with ReportNG?

I want to get all the commands of the Selenium WebDriver...

I think ReportNG gets actions by methods (@Test) and reports them in HTML.

Thanks in advance.

To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/HhOHmQPhCp4J.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

Mike Riley

unread,
Aug 18, 2012, 10:43:13 PM8/18/12
to seleniu...@googlegroups.com
That depends on what you mean with step by step.  What do you consider a "step"?

I have not used ReportNG myself, just TestNG.  For additional info with TestNG I put out additional info using Reporter.log() about any particular test.

Mike

Anderson Corbellini

unread,
Aug 19, 2012, 12:27:48 AM8/19/12
to seleniu...@googlegroups.com
I consider a step by step report like this example...

Link: http://loggingselenium.sourceforge.net/samples/sampleResultJunitAssertionFailed.html

Getting all WebDriver actions... for example:

driver.get("http://www.google.com");
driver.findElement(By.name("q"));
driver.
sendKeys("Cheese!");

Thanks in advance.

To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/QuQlP111FP0J.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

Shaba K

unread,
Aug 21, 2012, 5:11:30 AM8/21/12
to seleniu...@googlegroups.com
@Mike,

He was keen on NUnit report is guess, not sure TestNG fits his requirement.

cheers,
s

To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/HhOHmQPhCp4J.
Message has been deleted

Corbellini

unread,
Aug 21, 2012, 11:26:06 PM8/21/12
to seleniu...@googlegroups.com
@People

The TestNG has not a custom report detailed that it can provide a step by step...

I am trying to create a custom report for Selenium WebDriver, but I don't know how I can get the actions on it.

If anyone know any solution to report step by step in the Selenium WebDriver, please share it... :-)

Thanks in advance

Peter Gale

unread,
Aug 22, 2012, 2:43:32 AM8/22/12
to Selenium Users
I think you'd have to write a wrapper function for each WebDriver action and write the log entries you require before/after executing each WebDriver action.


Date: Tue, 21 Aug 2012 20:26:06 -0700

From: corbel...@gmail.com
To: seleniu...@googlegroups.com
Subject: Re: [selenium-users] Nice HTML report using WebDriver

To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/JT67aPzmusoJ.

Krishnan Mahadevan

unread,
Aug 22, 2012, 2:59:47 AM8/22/12
to seleniu...@googlegroups.com
Here are a couple of approaches that I can think of :

1. Approach one

Abstract the Webelement as your own class and define specific classes for each of the html element types i.e., define an Abstract Class which would have the common features of all html element operations [click is a good example], extend this abstract class and define concrete implementations for button, textbox, textarea, link, image etc., and provide user friendly methods for click, type etc., and within these methods, embed the relevant logging.

2. Approach two
Use the EventFiringWebDriver implementation instead of the other concrete flavors of WebDriver. Register an event listener [a class that implements WebDriverEventListener] to this WebDriver and within your event listener class, implement the necessary logging mechanism.
[The caveat here is, this wouldn't work with operations triggered via org.openqa.selenium.interactions.Actionsas well as org.openqa.selenium.support.ui.Select]


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

Anderson Corbellini

unread,
Sep 1, 2012, 8:39:37 PM9/1/12
to seleniu...@googlegroups.com
Hi Guys!

Sorry for my delay to answer your sugestions... Thank for all the replays... :-)

@Peter Gale
That's it... I'd have to write a wrapper function for each WebDriver.

@Krishnan Mahadevan
I think the approach number one is the best... I will be researching how I can do this implementation. 

@Logan Masniuk
Sure... We are in the same boat... :P We can work together to find a solution. I want to get all the actions of WebDriver as the  LoggingSelenium get with the Selenium RC. I have already studied the LoggingSelenium code, but I had no success. I added you on GoogleTalk, then we can exchange any idea.

If anyone has already gone through it... please share it with us. 

Thanks in advance

On Fri, Aug 24, 2012 at 5:48 PM, LMasn <logan....@gmail.com> wrote:
I am currently trying to solve the same problem as you Corbellini.
I have different classes for each test case that I need and am currently logging the actions using java.util.logging.*
Here is my code for setting up the logger
<code>
import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;

public class DebugLogger {

    public static Logger setUpLogger() {
        Logger logger = Logger.getLogger("theTest.log");
        Level debugLevel = Level.INFO;
//        Level debugLevel = Level.FINE;
        try {
            FileHandler handler = new FileHandler("messagez.log", false);
            logger.addHandler(handler);
            logger.setLevel(debugLevel);
            SimpleFormatter formatter = new SimpleFormatter();
            handler.setFormatter(formatter);
        } catch (IOException e){
            System.out.println("Could not create file. Using the console handler");
        }
        return logger;

    }

}
<code>
The problem with my approach is that I have to include a line of code before each action that I want to log for example
<code> logger.info("Starting Test: Open Webpage");<code> This would be used when I start the test, I set the logging level as INFO so that it appears in my log no matter what
or for individual actions I use <code>logger.fine("Type 'aquarium' into search bar");<code>

I log the start and end of the test in the INFO level and use a line of code on logging level FINE for each action that I do and in my DebugLogger class I simply set the debugLevel to FINE(by commenting out INFO and de-commenting FINE). I set the debugLevel to fine if the test fails and I need to pinpoint where it failed(by looking at the generated log).

This method works, BUT it generates a single .log file that is just a large block of text, with alot of repeated timecode text.
For example:
24-Aug-2012 9:27:24 AM com.company.tests.OpenWebpage testOpenWebpage
INFO: Starting Test: Open Webpage in FireFox
24-Aug-2012 9:27:29 AM com.company.tests.OpenWebpage testOpenWebpage
INFO:Open Webpage has Passed in FireFox
24-Aug-2012 9:27:30 AM com.company.tests.OpenWebpage testOpenWebpage
INFO: Starting Test:  Open Webpage  in Chrome
24-Aug-2012 9:27:35 AM com.company.tests.OpenWebpage testOpenWebpage
INFO:  Open Webpage has Passed in Chrome


Now imagine this repeated over and over for more than 15 test cases.
Also I think it would be worth mentioning that I am not using selenium grid due to the fact that I have searched high and low trying to figure out how to implement cross-browser testing in the grid to no avail. Instead my tests run sequentially in firefox then chrome using a driverFactory that I created.

All that being said, I am stuck in the same boat as you trying to figure out how to log these individual steps, and the pass/failure of a test case in a easy to read HTML file and am stuck. After reading all the comments I believe I am looking for the same kind of logging functionality that you desire and hope that we can find out a solution.

One thing I have noticed is that support for selenium on the web exists for many different implementations and often times I find it very hard to find solutions particular to my setup which is; Selenium Webdriver testing in Java using JUnit for testing. Most resources I find are solving Selenium RC issues, not webdriver.

If anyone can help us out that would be awesome! 
Cheers

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/uLM_f8weh1cJ.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

Anil

unread,
Sep 20, 2012, 3:41:22 PM9/20/12
to seleniu...@googlegroups.com
Hi Corbellini,
Even I am looking for similar solution.

Keep me posted.
Let me know if I can help.

Also, should you/we try to port seleniumlogging with webdriver?
Or hook them together using with WebdriverbackedSelenium class?

Anil

Corbellini

unread,
Sep 27, 2012, 2:45:42 PM9/27/12
to seleniu...@googlegroups.com
Hi Anil!

The SeleniumLogging just works with Selenium RC, I have tried to adapt it to WebDriver, but I had not success.

We should create a listener class to get all the events of WebDriver, but I couldn't identify which the best solution.

According to posts previous there are the EventFiringWebDriver and WebDriverEventListener that can be used to listen the events.

Do you have any idea?

Thanks in advance.

Anshoo Arora

unread,
Jul 14, 2015, 2:02:43 PM7/14/15
to seleniu...@googlegroups.com
Corbellini

I know this is an old question, but in case you are still looking for a solution or other readers are, with C#, depending upon the type of logging you are trying to create, you can either use ExtentReports if you want to use a logger type utility or ReportUnit if you want to simply convert your test-framework results into HTML.

Samples:

ExtentReports:  http://relevantcodes.com/extentreports-for-selenium/ | http://relevantcodes.com/Tools/ExtentReports2/Extent.html
ReportUnit: http://relevantcodes.com/reportunit-report-generator/ | http://relevantcodes.com/Tools/ReportUnit/Index.html

Cheers, 

Anshoo

Reply all
Reply to author
Forward
0 new messages