18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
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.
How do i get select a value from a drop down list
OS : Windows 7
Broswer : firefox 7.0.1
Build: 2011-07-19
Hi
How do i select a text value (say the send value or the 5th value) from a dropdown list of say 10 values/names?
i tried the follwoing but it doesn't work.
_set($var2, _select("ctl00_ContentPlaceHolder1_ddlContactName").options.value);
_alert($var2);
_set($var2, _select("ctl00_ContentPlaceHolder1_ddlContactName").options.length);
_alert($var2);
pl advise
George
Broswer : firefox 7.0.1
Build: 2011-07-19
Hi
How do i select a text value (say the send value or the 5th value) from a dropdown list of say 10 values/names?
i tried the follwoing but it doesn't work.
_set($var2, _select("ctl00_ContentPlaceHolder1_ddlContactName").options.value);
_alert($var2);
_set($var2, _select("ctl00_ContentPlaceHolder1_ddlContactName").options.length);
_alert($var2);
pl advise
George
Comments
I think you should try with _setSelected() instead of _select in your code.
thank you
chinmaya
let's assume you have a dropdown with name="Title".....
The first option is Blank followed by Mr, Mrs, Doc, Prof & Dr
So, to select Doc:
_setSelected(_select("Title"), "Doc");
To select by index:
_setSelected(_select("Title"), 3);
REMEBER:
Selecting based on index always starts from 0.
Hope this helps.
Orrin