Dashboard > Selenium > ... > Contributed User-Extensions > collect extended info about failures
Selenium Log In View a printable version of the current page.
collect extended info about failures
Added by Andrey Yegorov, last edited by Andrey Yegorov on Oct 29, 2007  (view change)
Labels: 
(None)

Short description

I had certain difficulties analyzing failures after execution of Selenium's test, especially when tests were executed in a 'continuous integration' mode overnight:

  • I could not see values that variables had at the moment of failure. It is especially critical if value assigned to variable generated in test or requested from the web service.
  • I could not see a page content at the moment of the failure. So I had no way to quickly figure out what happened - previous navigation failed, control was not present, server error happened etc.

It especially hurt in cases of irreproducible failures.

I thought about using some tool to record video of test run (yuck, bulky AVIs, hard to locate point of the failure) or of a way somehow take a 'regular' jpg screenshot. Both did not look like a good idea because in case of multi window mode it will show only top part of the page.
So I decided to proceed with simply grabbing html of the AUT.

Attached extension is a first (rather quick and probably rough) attempt to solve the problems described above.
'Screenshot' is somewhat not too nice looking because it is simply html of the page, missing css etc. So far it works for me especially considering that I did not have much time to improve it.

How to use

Just include attached code into your user-extensions.js. It was tested with Selenium Core 0.8.0.
Run your tests as you usually do.

Sample output

A cool extension. It's really useful for me.

Some of my suggestions:
1. Move extension source from user-extension.js to selenium-testrunner.js.
Then, selenium-ide user will not receive js error alert.

2. Error page source capture code:
selenium.page().getDocument().body.innerHTML only captured body html. It may cause CSS and JS missing, which are usually included in html head.
Modify it to:
'<html>'+ selenium.page().getDocument().getElementsByTagName("html")[0].innerHTML + '</html>'
Then, we capture the whole html. CSS/JS effect are better in popup window now.

thanks,
Jerry

Site running on a free Atlassian Confluence Community License granted to OpenQA. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.6 Build:#812 Aug 06, 2007) - Bug/feature request - Contact Administrators