Debugging Selenium Tests
At the time a test fails, it passes through the Selenium client, Selenium Server (or Selenium RC in Selenium 1), the browser, the
Javascript mechanism and the application function.
The testers usually have 5 degrees of separation in
relation to the cause of the problem. Most of us are interested in knowing how the
code is running. Sometimes, even if we write the code without syntax errors
during execution, we face problems that require code debugging.
As the web controller script runs quickly, if we
want to run the web driver code line by line and check if the output can be
obtained using the debug mode in Eclipse.
The first technique is to capture a screenshot every
time a test fails. There are some methods provided for this:
·
Capture Screenshot
·
Capture ScreenshotToString
Ø
Access Capture Screenshots of Selenium
Failures, in the YouDevise Developer blog, provides an example of Java code to
know how this approach can be implemented.
Ø
The second technique is to capture the
contents of the HTML DOM when a test fails. For this, Wellman recommends using
the getHtmlSource method to capture the contents of the DOM and burn them to a
file.
Taking the time to
incorporate these two techniques could pay generously in time saved debugging.This is not the first time that Wellman wrote about the value of investing in
his tools to get more productivity.
Below are the problems
I frequently encounter when using the Selenium:
v
Element is not ready yet. Selenium
reports 'Element not found'. In Ajax environments this is
usually caused when the Selenium test is out of sync with the web application.
I have solved this by adding the waitForElementPresent commands before each
click, type, view and validate the command
v
Selenium jump points. Right-click on a
Selenium command in the Selenium
IDE
or in the Test Test Designer to set a breakpoint. After the Selenium IDE or the
designer reaches this point of interruption, you can inspect the state of the
application using the Firebug debug utility.
v
TestMaker Object Designer evaluation
guide. The Designer allows you to make calls from the Javascript API to the
Javascript engine that is running the Designer or the Javascript mechanism
executing the Ajax Web objects of the application being tested.
v
The debugging
of your tests is easy and useful - it allows you to test your behavior line a
In the event of an error in the operating system, it must be taken into account
that the operating system is not compatible with the operating system.
v IDE compatible with debugging (PHPStorm,
NetBeans, etc.) Start Administrator with
the parameter –xdebug.
To getting expert-level training for Selenium Training in your location –
Selenium Training in Chennai | Selenium Course in Bangalore | Selenium Training institute in Bangalore
Comments
Post a Comment