Can I validate pull-down menu options?
Have you ever wanted to test pull-down menu options?
- Validate the values in a pull-down menu.
- Validate that a particular value exists (or does not exist) in the pull-down menu.
With Autify, you can test the values in pull-down menus by using the following assertions:
- Element Text Should Be
- Element Should Contain
- Element Should Not Contain
Let's look at how to record a step that validates pull-down menu options.
When recording, please be aware that when you focus on the
select element of a pull-down menu, the assertions "Element Text Should Be" and "Element Should (Not) Contain" commands will not appear.
To make these commands appear, focus on the parent element of the
select element, such as
When you focus on a
div element, the commands "Element Text Should Be" and "Element Should (Not) Contain" will appear.
Let's say we selected "Element Text Should Be." In the Value section, options within the pull-down menu appear. Select the option you wish to validate and click "Save Assertion."
That's it! You now know how to test the options within a pull-down menu.
Next, let's check whether an option does not exist in a pull-down menu.
Here, we will select "Element Should Not Contain" in the Command section and choose an option that does exist in the Value section. Let's see if the test fails.
As expected, the test failed! This is because the value we selected exists within the pull-down menu.
To sum up, you can test pull-down menu options by using the assertions "Element Text Should Be," "Element Should Contain," or "Element Should Not Contain."