18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

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.