Endtest

Endtest

›Web Tests

Web Tests

  • How to create Web Tests
  • Finding elements in Web Applications
  • How to execute Web Tests
  • Assertions for Web Tests
  • IF Statements for Web Tests
  • Web Applications with restricted access
  • How to test in iframes
  • How to test in multiple tabs
  • How to test File Uploads
  • How to test File Downloads
  • How to test Emails
  • How to test PDF files
  • How to test Chrome Extensions
  • Dealing with reCAPTCHA
  • Dealing with Dynamic Locators
  • Dealing with Canvas Elements
  • Performing a Drag and Drop
  • Execute JavaScript
  • Testing WebRTC Applications
  • How to scroll in Web Tests
  • How to test Checkboxes
  • How to test Dropdowns
  • Dealing with Sessions
  • Web Crawler
  • Export Web Tests
  • Migrating from Selenium

Mobile Tests

  • How to create Mobile Tests
  • Finding elements in Mobile Applications
  • How to execute Mobile Tests
  • Assertions for Mobile Tests
  • IF Statements for Mobile Tests
  • How to scroll in Mobile Tests
  • Performing Complex Gestures

Advanced

  • Variables
  • Waits
  • Endtest API
  • Scheduler
  • Drive
  • Adding Collaborators
  • Computer Vision
  • Importing Test Cases
  • Using Loops
  • Data-driven Testing
  • Send API Requests
  • Read SMS
  • Execute SQL queries
  • Self-Healing Tests
  • Email Notifications
  • Slack Notifications
  • PagerDuty Notifications
  • Webhook Notifications
  • Automatic Backup
  • Advanced Settings
  • Multiple environments
  • How to stop a test
  • Utilities
  • Utilities API
  • Team
  • On-Premises

Integrations

  • Atlassian Jira
  • Slack
  • PagerDuty
  • Microsoft Teams
  • Mattermost
  • Jenkins
  • GitHub
  • Azure DevOps
  • GitLab
  • TeamCity
  • CircleCI
  • TravisCI
  • Bitbucket
  • Heroku
  • Bamboo Server
  • Test Case Management
  • SSO
  • BrowserStack
  • Sauce Labs

How to test Dropdowns

Introduction

A dropdown element allows a user to select one or more options from a limited set of choices.

In web applications, there are 2 types of dropdowns:

  1. Classic Dropdowns
  2. Modern Dropdowns

1. Classic Dropdowns

A classic dropdown is a <select> element, with <option> elements inside.

This is what the HTML of a <select> dropdown looks like:

<select name="pets" id="pets">
     <option value="cat">Cat</option>
     <option value="dog">Dog</option>
     <option value="rabbit">Rabbit</option>
</select>

The best way to interact with that <select> element is with the Select Option action.

In the Select Option step, you have to provide the locator for the <select> element and the option you want to choose.

In the Option to pick input, you need to provide the text from the <option> element, or the value, or the index.

For example, if we want to select the Rabbit option from our dropdown:

Strategy Value
Text Rabbit
Value rabbit
Index 2

Here is what the step would look like if we use the value:

endtest dropdown select

You can also pick an option by using 2 Click steps.

The first Click step will open the dropdown.

And the second Click step will pick the option.

endtest dropdown select click

2. Modern Dropdowns

Since <select> elements have limited styling options, you'll encounter modern dropdowns in some web applications.

One good example is the Browser dropdown from our Web Tests section:

endtest dropdown modern

A modern dropdown is usually built with <div> elements.

Sometimes, those <div> elements might be generated on top of <select> elements that are no longer interactable.

The Select Option action is built to work only with classic dropdowns (<select> elements).

For modern dropdowns, you will need to use 2 Click steps, one to open the dropdown, and one to pick the option.

endtest dropdown modern click

Technically, you could also use an Execute JavaScript step to select an option from a dropdown.

But that option is only recommended as a last resort, since it does not mimic a real user.

← How to test CheckboxesDealing with Sessions →
  • Introduction
  • 1. Classic Dropdowns
  • 2. Modern Dropdowns
© Endtest Inc.