Share
Go down
bharathip
Posts : 8
Join date : 2011-11-08

comparing a string with the strings present in the drop down list

on Fri Nov 11, 2011 12:38 pm
Hi all

I want to throw an exception if ,a string given in excel sheet is not present in the drop down list of an application.
how to check whether a string is present in the drop down list or not.

Can anyone help me...!!
freesky
Amateur
Amateur
Posts : 72
Join date : 2011-04-13

Re: comparing a string with the strings present in the drop down list

on Fri Nov 11, 2011 3:48 pm
assertText or verifyText
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

Re: comparing a string with the strings present in the drop down list

on Mon Nov 14, 2011 3:05 pm
You can use one of the getSelect... methods.
For example:
getSelectOptions(selectLocator) - gets all option labels in the specified select drop-down.
And then verify if the text is presented in returned array.
dine
Posts : 1
Join date : 2012-03-30

Re: comparing a string with the strings present in the drop down list

on Fri Mar 30, 2012 5:05 am
Hi faramka,
I don't know how to use getSelectOptions nether how to verify if the text is present in a array. Could you give an example? Embarassed Thanks very much!!
deshjoshi
Posts : 4
Join date : 2012-04-01

Re: comparing a string with the strings present in the drop down list

on Sun Apr 01, 2012 1:16 pm
Hi,

You can try following command to verify the text present in dropdown:

assertTrue(selenium.isElementPresent("css=select#unitNameSelection:contains('"+lstrVehName+"')"));

In the above command 'lstrVehName' Im passing it as a string variable.

Where,
unitNameSelection: Is ID of your dropdown box.
lstrVehName: Is text is to verify in the dropdown.
Sponsored content

Re: comparing a string with the strings present in the drop down list

Back to top
Permissions in this forum:
You cannot reply to topics in this forum