Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

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

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

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...!!
avatar
freesky
Amateur
Amateur
Posts : 72
Join date : 2011-04-13

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

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

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

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.
avatar
dine
Posts : 1
Join date : 2012-03-30

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

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!!
avatar
deshjoshi
Posts : 4
Join date : 2012-04-01

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

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

comparing a string with the strings present in the drop down list Empty 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