Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, windows and java based applications. Get your 30 day free trial.

Discuss your Sahi Pro usage patterns, best practices, problems and solutions. Help others solve their problems and seek help from the community when needed. If you need specific support on your application, please email support @ sahipro.com

Verify if an option exists in the drop down

viswaviswa Members
edited November -1 in Sahi - Open Source
We created a new option for our drop down. And we tried with the following codes, to verify if the created option exists in the drop down:

Option 1:assertTrue(browser.option(browser.select("Select_id"),"optionName").exists());

Option 2:assertTrue(browser.select("Select_id").containsText( "optionName"));

Both the options return false even if the option exists in the drop down

Any suggestions please.

Comments

  • _dkulkarni_dkulkarni Members
    edited May 2011
    Hello viswa,

    You will have to use the "in(ElementStub inEl)" method to specify that <option> should be searched in <select>.
    Try this.
    assertTrue(browser.option("optionName").in(browser.select("Select_Id")).exists());
    

    Regards,
    dkulkarni
Sign In or Register to comment.