Monday, November 29, 2010

How to verify value in drop down list.

Take an example How to find some value is in drop down list or now? To find element drop down is easy but to find a drop down having some specific
value in their list is difficult.

Go to www.ebay.in you will see there is drop down along with search text box.
How to veify a specific value "Collectibles" is in drop down list.

Using Xpath:



verifyElementPresent
//select[@id='_sacat']/option[contains(text(),'Collectibles')]



verifyTrue(selenium.isElementPresent("//select[@id='_sacat']/option[contains(text(),'Collectibles')]"));


Using CSS:



verifyElementPresent
css=select#_sacat>option:contains("Fun")



verifyTrue(selenium.isElementPresent("css=select#_sacat>option:contains(\"Fun\")"));


verifyElementPresent
css=select>option:contains("Fun")

No comments:

Post a Comment