Saturday, March 6, 2010

Invalid argument error on Selenium RC Server while selecting option from drop down in IE

If you try to select a label in a drop down using type command in selenium, what do you expect it to do??

Throw error??

or work fine??

Well, both the statements are true. The first one holds true for IE, and second one holds true for Firefox.

If you try to use the following command for to select option from the drop down using a type command, Firefox will work cool, but IE will throw an Invalid argument error.

//Here type function sends the type command to selenium incorrectly to select a label from drop down.
$object->type('id=id_for_drop_down', 'label_in_a_drop_down');

This will throw the said error in IE and we can not blame it on IE all the times.

So just change it to send the command to select the label and it will work fine for you. So the new code will look like this:

//HERE SELECT OPTION FUNCTION SENDS THE SELECT FROM DROP DOWN COMMAND TO SELENIUM
$object->select_option('id=id_for_drop_down', 'label_in_a_drop_down');

Hope it helps.

Thanks,
QuickSilver1183
QuickSilver1183@gmail.com

No comments:

Post a Comment