selectByName

Select option with a specific name.

Usage

1
client.selectByName(selectElem,name).then(callback);

Parameters

Param Type Details
selectElem String select element that contains the options
name String name of option element to get selected

Example

example.html
1
2
3
4
5
6
7
8
<select id="selectbox">
<option name="someName0" value="someValue0">uno</option>
<option name="someName1" value="someValue1">dos</option>
<option name="someName2" value="someValue2">tres</option>
<option name="someName3" value="someValue3">cuatro</option>
<option name="someName4" value="someValue4">cinco</option>
<option name="someName5" value="someValue5">seis</option>
</select>
selectByName.js
1
2
3
4
5
6
7
8
9
10
client
.getValue('#selectbox').then(function(value) {
console.log(value);
// returns "someValue0"
})
.selectByName('#selectbox', 'someName3')
.getValue('#selectbox').then(function(value) {
console.log(value);
// returns "someValue3"
});

Uses