selectbytext
Last updated
Last updated
Select a dropdown, a checkbox or radiobutton.
Property
text
text display on the screen. Can be empty.
Parameter
item
item to select in the list
The associated label
, aria-label
, name
, current selected item
or adjacent text
can be used to identify the list.
For example, in https://webactions.w3spaces.com/select.html, the car list has a label
"Choose a car:"
if we use the action "selectbytext" with Property="Choose a car:" and Parameter="Opel", it will select the item Opel in the car list :
if we use the action "selectbytext" with Property=empty and Parameter="Volvo", it will select the item Volvo in the car list
We can use context to manage duplicated text. For example, if we use the action selectbytext with Property="Choose a car:|context=create a drop-down list" it will search for the car list in the context of "create a drop-down list" .
Property
text
text (or part of the text) display on the screen.
Parameter
yes
The associated label
, aria-label
, name
, value
or adjacent text
can be used to identify the checkbox.
For example, in https://webactions.w3spaces.com/checkbox.html, the bike checkbox has a label
"I have a bike"
if we use the action "selectbytext" with Property="I have a bike", it will check "I have a bike":
We can set property with 2 texts seperated by a "|". In this case it will search for a check box in a group described by its text.
For example, if we use the action "selectbytext" with property="Show Checkboxes|I have a car", it will check I have a car in the group Show Checkboxes:
We can also use context. For example, if we use the action selectbytext with Property="I have a car:|context=Show Checkboxes", the result is similar with property="Show Checkboxes|I have a car"
Property
text
text (or part of the text) display on the screen.
Parameter
yes
The associated label
, aria-label
, name
, value
or adjacent text
can be used to identify the radio.
For example, in https://www.w3spaces-preview.com/webactions/radio.html, a radio button has a label
"31 - 60"
If we use the action "selectbytext" with property="31 - 60", it will select the radio 31 - 60 :
We can set property with 2 texts seperated by a "|". In this case it will search for a radio in a group described by its text.
For example, if we use the action "selectbytext" with property="your age|0-30", it will select 0-30 :
We can also use context. For example, if we use the action selectbytext with Property="0-30:|context=your age", the result is similar with property="your age|0-30"