Using the selenium IDE and Rubymine

This post explains how to debug a Selenium test script in Rubymine like you would in the selenium IDE. It is common to have a missing element failure in a recorded selenium script.  A quick way to debug this in the Selnium IDE is to put a break point in your script and use the execute command button to find the right code for your failing command.
Add breakpoints start and stop test execution

Add breakpoints start and stop test execution

In the case of a failing script you can see below that the failing line is highlighted in red and you can see the log message explaining the error.
Failing script

Failing script

So when you export your selenium IDE script to your favorite language, how do you trouble shoot failures like this easily in your development environment?
Test Script

Test Script

I generated an error in the script by changing the name of the google button from “btnG” to “btn” .  Trouble shoot this error by using the Rubymine debugger and evaluate expression tool.  I put a break point on the line of code that is failing.  Then I can select the text and open the evaluate expression tool to see if I can locate the button.
picture-15

When you get the expression correct, you will see a message, result = nil.  This is a great tool for testing xpath expressions.

Successful Evaluation

Successful Evaluation

If you noticed that the code I used in this example is different than what is exported from the Selenium IDE, it is because I use the selenium-client gem and execute my tests using the selenium grid.

Comments are closed.