Search
 
 

Display results as :
 


Rechercher Advanced Search

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

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

View previous topic View next topic Go down

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

Post by bharathip 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...!!

bharathip

Posts : 8
Join date : 2011-11-08

Back to top Go down

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

Post by freesky on Fri Nov 11, 2011 3:48 pm

assertText or verifyText

freesky
Amateur
Amateur

Posts : 72
Join date : 2011-04-13

Back to top Go down

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

Post by faramka 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.

faramka
Professional
Professional

Posts : 143
Join date : 2011-09-15
Location : Poland

Back to top Go down

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

Post by dine 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!!

dine

Posts : 1
Join date : 2012-03-30

Back to top Go down

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

Post by deshjoshi 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.

deshjoshi

Posts : 4
Join date : 2012-04-01

Back to top Go down

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

Post by Sponsored content Today at 5:11 pm


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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