- Print
- DarkLight
Step that selects a value from a list
When you record the action that selects a value from a list implemented with a <select>
element, a [Select ... From List] step is created.
<select>
elementWhen you record an action that selects a value from a list implemented with anything other than a <select>
element, it will typically result in two clicks being recorded: a click that opens the options and another click that select an option.
Search target
During test runs, Autify looks at the options within the list and searches for the value set in the "Label".
The search target is the value enclosed in the option tag (<option>This string</option>
). Currently, Autify does not support options where the option tag doesn't enclose a value, for example <option label="1" value="1"></option>
.
The [Select ... From List] step currently does not support selection by any method other than complete label matching, such as:
- Selecting the Nth option.
- Selecting an option that contains '~'.
- Selecting an option that starts with '~'.
If the step is not recorded
Autify Recorder detects when a value has changed (such as when a selection has changed) and records steps accordingly. Therefore, if you re-select an already selected value, the [Select ... From List] step will not be recorded.
To record the step, you can first select a different option, then re-select the desired value. Afterward, you can remove any unnecessary steps.
If the value is not recorded
Since Autify does not currently support options where the option tag does not enclose a value, such as <option label="1" value="1"></option>
, if you record the action that selects such an option, the value won't be recorded and "..." in [Select ... From List] will be blank.
If you enter a value in the Scenario Edit page afterwards, Local Replay will work, but Autify not will be able to find the option during test execution, causing the test to fail.
Local Replay is a feature that helps when updating test scenarios, and its behavior may be different from test execution. This is one such difference. For more details, see Record here (Local replay) - 3. The difference between Local Replay and test execution
Add a locator
When adding a locator, be sure to specify the CSS selector/XPath of the <select>
element you want to select, not the <option>
element. If you specify a CSS selector/XPath of an element other than the <select>
element, Local Replay and test execution will fail.
Please note that specifying the CSS selector/XPath of the option you wish to select in the locator does not result in the selection of that option.
Lists that allow multiple selections
Lists with the "multiple" attribute allow you to select multiple options. If you perform an action that changes the selected option in a list that allows multiple selections, Autify creates two steps: [Unselect ... From List] and [Select ... From List].
If you select "1" and then select "2", these steps will be recorded:
If you select "1" and then select "2" while holding down Shift or Ctrl (cmd), the [Unselect ... From List] step will not be created: