Selenium, what a great tool

Whilst trying to write some code which would rollover Blackboard courses automatically, year in year out.

We where looking for an answer to using a ‘value’ or piece of ‘text’ which was next to a checkbox rather than the ‘id’ (which is the usual way Selenium handles checkboxes), as the ‘id’ in our case was being dynamically generated so it couldn’t be relied upon being the same number, as it depended how many checkboxes where on that particular screen.

Here’s how we solved it :

selenium.click(”//input[@value='users']“);

where ‘users’ is the value from within the code, rather than ‘Users’ which is just some text after the checkbox, which display next to it, so not really that connected, actual code from within Blackboard (yuck) follows :

<input type='checkbox' name='area' id="area_14" value="users"> <label for="area_14"><font class="fnt0"><b>Users</b></font>

* Note, this only seems to work with Selenium using Firefox 3 as the browser rather than IE.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s