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.

Select Dropdown value dynamically

DaltonDalton Members
edited August 2013 in Sahi - Open Source
Hi all,
I have a drop down which populates credit cards automatically when i added a credit card and hit refresh button,. I may have a zero,one or more credit cards at the time of adding new card
But i want to choose a card which is added (eighter first or last)

I used the below code

Browser().select("/r2:1:r1:1:r\\d:0:soc1/").choose("/\\*.*/");

but not working properly

Any alternative for this???????

Best Answer

  • you can use collect() api to collect all the values in the drop down into an array, so that you can select which ever value you want from the DropDown.

    eg:var $els = _collect ("_link", "/group 1/", _in(_div("div1")));
    you can also use count to count all the values from the dropdown using count() api
    var $c = _count ("_link", "/group 1/");
Sign In or Register to comment.