- bharathip
- Posts : 8
Join date : 2011-11-08
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...!!
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...!!
- freeskyAmateur
- Posts : 72
Join date : 2011-04-13
Re: comparing a string with the strings present in the drop down list
Fri Nov 11, 2011 3:48 pm
assertText or verifyText
- faramkaProfessional
- Posts : 143
Join date : 2011-09-15
Location : Poland
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.
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
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? Thanks very much!!
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? Thanks very much!!
- deshjoshi
- Posts : 4
Join date : 2012-04-01
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.
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.
- selenium RC not able to choose a value in drop-down list which is build using ul tag...
- How to Capture a Drop down list values using Selenium + TestNg6.5
- How to select multiple item from the web list and drop down list in Webdriver
- How to use wild cards on drop down list IDs
- location of an element in a drop down list in selenium IDE
Permissions in this forum:
You cannot reply to topics in this forum