Dropdown practice website
Practice the three dropdowns test suites meet most: a native select, a searchable combobox and a multi-select. Each comes in a well-built and a fragile form. Open the shop catalog
Native selectA real <select> element.
Built well
Built to break
Searchable comboboxType to filter, then pick a suggestion.
Built well
Built to break
Multi-selectChoose several options; remove them from the chips.
Built well
Built to break
Menu that closes when you inspect itIt closes when the page loses focus. In DevTools, turn on "Emulate a focused page" to inspect it.
Built well
Built to break
Tasks: write a locator, get a grade
How to locate Dropdowns
Most dropdowns are not selects
A native <select> is the easy case. Every tool has a built-in way to choose an option: selectOption in Playwright, .select() in Cypress, the Select class in Selenium. It goes wrong when the select has no label and the test picks options by position. The fragile select on this page reorders its options on v2, so “the third option” becomes a different category.
Most dropdowns in modern apps are not selects at all. They are inputs and lists built from divs, so selectOption and the Select class throw. A test has to click or type to open the list, wait for the options, and click one. When suggestions come from a server, that wait is where flaky tests come from.
Component libraries often render the list somewhere else in the DOM, usually at the end of <body>, so it can float above everything. The fragile combobox does this. A locator scoped to the input’s container finds nothing, and one that searches the whole page by text breaks when the wording changes.
Multi-selects add state. A test needs to know which options are selected and how to remove one. Without ARIA, the only signal is a class name or a check mark glyph, and both change between builds.
What a stable locator looks like
For a native select, find it by its label or test id and choose by value, not by index. For custom dropdowns, use ARIA roles: role="combobox" for the input, role="option" for each suggestion, and aria-selected for what is chosen. The well-built forms on this page expose all three.
await page.getByLabel('Sort by').selectOption('phones');
await page.getByRole('combobox', { name: 'Search products' }).fill('cam');
await page.getByRole('option', { name: 'Cameras' }).click();
await page.getByTestId('multi-select').click();
await page.getByRole('option', { name: 'Audio' }).click();
await expect(page.getByRole('option', { name: 'Audio' }))
.toHaveAttribute('aria-selected', 'true');In a real workflow
The shop’s catalog uses all three: a category multi-select, a sort dropdown built the fragile way, and a product search combobox in the header. Filter to one category, sort by price, then search for a product and open it.
COR Lens generates locators for shadow DOM, iframes and tables, and grades each one. Click the dropdowns above with it and compare its pick with yours.
Add to Chrome