Odin Technology - Automated Software Testing

Axe Test Automation Platform

General discussion relating to the Axe Test Automation Platform from Odin Technology

Posts by Odin employees marked:

Capture entire screenshot on fail

Hi

I am using AXE v3.1 and Selenium

I would like to capture the entire page on test abort instead of just capturing the visible screen area.

The Selenium API provides a captureEntirePageScreenshot method - http://release.seleniumhq.org/selenium-core/1.0/reference.html

In the Action Map for the current project I am working on I can see that as part of the _testEnd(id) action there is a command 'Dispatch.call(axe,"TestAbort"); however I am having trouble tracking down where this "TestAbort" resides as I presume this is where AXE specifies that the captureScreenshot method is used instead.

As the captureEntirePageScreenshot method only works for Firefox, I would also need to be able to specify to use this if the Firefox browser is used, else use captureScreenshot

Any help you could provide is much appreciated
Mark Winspear Send private email
Friday, August 12, 2011
 
 
Hi Mark,

The TestAbort method is part of the Axe runtime API and you will not be able to change it locally. However, you can add your own screen capture call after the call to TestAbort and just overwrite the snapshot taken by Axe. e.g. Override your __testEnd ActionMap entry to add the following line after the TestAbort call:

selenium.captureEntirePageScreenshot("%^RESULTDIR%/images/%TESTID%_Abort.jpg", "")

NB: captureEntirePageScreenshot captures a PNG image but by giving it a JPG extension we ensure it can still be viewed from the link in the Axe results.

It is then easy enough to add a check for the browser version around the call. You can either use the Selenium navigator.userAgent property, or the Selenium Browser property from the Axe RunConfig file.

Sam
Sam Warwick Send private email
Monday, August 15, 2011
 
 
Thanks for your help on this!

The full code used following the Dispatch.call(axe, "Test Abort"); command in the SeleniumJava.ActionMap file is:

String browser = selenium.getEval("navigator.userAgent");
                if (browser.contains("Firefox") || browser.contains("MSIE"))
                {
                            selenium.captureEntirePageScreenshot("%^RESULTDIR%/images/%TESTID%_Abort.jpg", "");
                }
Mark Winspear Send private email
Monday, August 22, 2011
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics