Notes for using Selenium IDE

Selenium Notes

Question

Why do tests fail when encountering Xpath statements?
Answer

Follow this procedure to remove Xpath statements and replace with simple links. Note: I've modified these existing scripts to remove these statements, and will submit them to SVN.


Question

How to run a set of Selenium IDE tests at once, as a test suite?

Answer

Follow this procedure

Step one is generating an array of links. In this document, it is referenced as TestSuite.html. Below is a batch file you can use to generate a similar file for the Mifos tests checked into mifos/test/testscripts/Selenium/bvt:

Batch file:

@ECHO OFF
del runAllTests.html
echo ^<table^>^<tr^>^<td^>TestSuite for all tests^</td^>^</tr^> > runalltests.html.tmp
FOR /F %%i in ('dir /b /on *.html') do echo ^<tr^>^<td^>^<a target="testFrame" href="%%i"^>%%i^</a^>^</td^>^</tr^> >> runalltests.html.tmp
echo ^</table^> >> runalltests.html.tmp
ren RunAllTests.html.tmp runalltests.html

This batch file would generate a file called runalltests.html.

Step two is to execute the TestRunner via Firefox. The general format is as follows:

chrome://selenium-ide/content/selenium/TestRunner.html?baseURL=http://localhost&test=file:///dir/testsuite.html&auto=true


For my own testing, I copied the selenium scripts to a separate folder (c:\mifos-bvt) and enter the following url:

chrome://selenium-ide/content/selenium/TestRunner.html?baseURL=http://localhost:8080&test=file:/// c:/mifos-bvt/runalltests.html&auto=true

(Remove the &auto=true if you wish to manually start this test set)


Question

A selenium script enters date values into a form, but the date doesn't seem to be submitted to the server. Why?

Answer

Selenium doesn't automatically fire "blur" events, but some Mifos v1.1 business logic resides in JavaScript that requires the blur events to be fired. Luckily, there is a straightforward workaround that tricks the JavaScript business logic into setting the date for the form:

<tr>
<td>fireEvent</td>
<td>holidayFromDateYY</td>
<td>blur</td>
</tr>