Mouse hover practice website
Practice menus that only exist while you hover, three levels deep, and a menu that opens on right-click at the pointer. Open the admin settings
Nested hover menuAccount → Security → Two-factor.
Built well
Built to break
Right-click menu
Built well
Built to break
How to locate Mouse hover
A menu that is not there until you hover
Hover menus render their submenus only while the pointer is over the parent. A test that clicks a nested item directly fails because the item does not exist yet; it has to hover each level in order, and moving the pointer the wrong way closes the menu it just opened.
A well-built menu says what it is: role="menubar", role="menu" and role="menuitem", with aria-haspopup and aria-expanded on items that open a submenu. That lets a test find “Two-factor” by name once its parents are open. The fragile menu is nested divs with generated classes, found only by text and position.
Right-click menus need a real context-click, which each tool spells differently, and they usually appear at the pointer, outside the element you clicked. Pressing Escape or clicking elsewhere closes them.
What a stable locator looks like
Hover each level by its menu item name, wait for the next level, then click the leaf by name. For context menus, right-click the target, then scope to the menu by its role and name before choosing an item.
await page.getByRole('menuitem', { name: 'Account' }).hover();
await page.getByRole('menuitem', { name: 'Security' }).hover();
await page.getByRole('menuitem', { name: 'Two-factor' }).click();
await expect(page.getByTestId('menu-result')).toHaveText('Selected: Two-factor');
await page.getByTestId('context-area').click({ button: 'right' });
await page.getByRole('menu', { name: 'Row actions' })
.getByRole('menuitem', { name: 'Delete' }).click();
await expect(page.getByTestId('context-result')).toHaveText('Chose: Delete');In a real workflow
The admin’s settings screen has a fragile three-level hover menu (More → Integrations → Payments → Test mode), and the users screen opens a context menu on every row.
COR Lens generates locators for shadow DOM, iframes and tables, and grades each one. Click the mouse hover above with it and compare its pick with yours.
Add to Chrome