Thursday, January 4, 2018

sahi how to get fetch html select input tag selected value and or selected index number

sahi how to get fetch html select input tag selected value and or selected index number


to get a select lists selected index use .options.selectedIndex

UPDATE 20130902: .value didnt seem to work

if you want the selected options value (label) use .value _getSelectedText(_select("editTAParty:role"))

which will give you the label text as it is seen in the browser, e.g.: "Despatch"

the variable $role is sent in with a value of 1:

    _setSelected(_select("editTAParty:role"), $role);
    _wait(10000, _select("editTAParty:role").options.selectedIndex == $role);


so if your code isnt using index numbers for setting the select, then use _getSelectedText instead:
_wait(10000, _getSelectedText(_select("editTAParty:role")) == $role);


visit link download