Can I validate pull-down menu options?
  • 07 Sep 2022
  • 1 Minute to read
  • Contributors
  • Dark
    Light

Can I validate pull-down menu options?

  • Dark
    Light

Article Summary

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.

focus-select

To make these commands appear, focus on the parent element of the select element, such as div and p elements.
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.

focus-div

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.

not-exist

As expected, the test failed! This is because the value we selected exists within the pull-down menu.

fail-test

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."


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.