I noticed a slight quirk between IE and Firefox when testing with Selenium the other day, which in retrospect makes sense; however, it serves to demonstrate the challenges of user acceptance testing in the face of a heterogeneous browsing community.
Firefox manipulation of form selections works via the type command of the DefaultSelenium object. For example, the following sequence of commands works with Firefox:
driver.open(appPath + "/CreateUser.html");
driver.type("name", "SpongeBob");
driver.type("genus", "Sponge"); //this only works with firefox
driver.click("submit");
As you can see from the code above, genus is the name of a selection element on a web form.
IE, however, doesn’t accept the type command within form sections– you must actually use the select method of the DefaultSelenium object as follows:
driver.open(appPath + "/CreateUser.html");
driver.type("name", "SpongeBob");
driver.select("genus", "Sponge");
driver.click("submit");
The fix, luckily, is to go with the code that works for IE as it’ll also work within Firefox. It goes to show you, however, that writing generic code to facilitate testing of web code that’ll be viewed by multiple browser types can be challenging. If you write some tests that work for one browser, don’t assume they’ll work for them all until you’ve actually tried.

March 24th, 2007 at 2:17 pm
[…] Browser disparity in Selenium […]
April 2nd, 2007 at 12:42 pm
[…] Browser disparity in Selenium- Yours truly noticed a slight challenge with verifying web functionality between IE and Firefox […]
June 1st, 2007 at 2:10 pm
That’s interesting. If the view or page displayed does not contain a large number of form elements, what i like to do is simply get an array of all the buttons or drop-down selects on the page and then simply pick the one you need from the array given its position on the page. This assumes you wont be adding and subtracting elements from the form too often or at all, since your acceptance tests would need to change often, and we dont want that. Another work around is to use IDs on the form components and then call them by name.