Switch to v2 to see which selectors break.
Add to Chrome

Element not interactable practice

Practice the elements your locator finds but your test still can’t use: hidden until opened, covered by a banner, disabled until enabled, an invisible real input behind a styled one, and text drawn by CSS. Open the admin product editor

Hidden until you open it

Built well

Built to break

Edit

Covered by a bannerClick Subscribe, then accept the cookies first.

Built well

Built to break

Subscribe

We use cookies.
OK

Disabled until enabled

Built well

Built to break

✎

Invisible real inputThe checkbox you see is a span; the real one is invisible.

Built well

Built to break

Alerts

Text drawn by CSS

Built well

Aero HeadphonesSale

Built to break

Aero Headphones
How to locate Hidden elements

The locator is right; the element isn’t ready

“Element not interactable” and “click intercepted” errors mean the locator worked. The element exists, but something stops the action: it’s hidden with display: none, covered by another element, disabled, or has no size. Fixing the locator won’t help; the test has to change what it waits for or what it clicks.

Hidden fields are the classic case. The fragile form here keeps its input in the DOM at all times, just hidden, so a test finds it and then fails to type. Open the section first, and wait until the field is visible.

Overlays such as cookie banners, chat widgets and sticky headers sit on top of the element you want. Selenium raises ElementClickInterceptedException; Playwright waits and reports what is in the way. Close the overlay, don’t force the click: a forced click passes a test that a real user would fail.

Custom checkboxes and switches often hide the real input with zero size or opacity and draw a span instead. Clicking the input directly fails; clicking its label works, and a tool’s own check() usually handles it.

Text from CSS ::before or ::after is not in the DOM at all, so no XPath or text locator can see it. Read it with getComputedStyle, or ask for the text to be real.

What a stable locator looks like

Wait for the state the action needs, not a fixed time: visible before typing, enabled before filling, the overlay gone before clicking. Click labels for hidden inputs. Avoid forced clicks; they hide real bugs.

await page.getByTestId('edit-nickname').click();
await page.getByLabel('Nickname').fill('Sam');

// Close the overlay first, or the click is intercepted
await page.getByRole('dialog', { name: 'Cookie consent' })
  .getByRole('button', { name: 'Accept cookies' }).click();
await page.getByTestId('subscribe').click();

await page.getByTestId('enable-editing').click();
await expect(page.getByLabel('Company name')).toBeEnabled();
await page.getByLabel('Company name').fill('Kestrel');

// check() works through the invisible input
await page.getByRole('switch', { name: 'Email alerts' }).check();

// CSS-drawn text is not in the DOM
const sale = await page.locator('.pr-pseudo-sale')
  .evaluate((el) => getComputedStyle(el, '::before').content); // '"Sale"'

In a real workflow

The admin’s product editor asks for confirmation in a dialog before saving, and the settings screen hides its options inside accordion sections until opened.

COR Lens generates locators for shadow DOM, iframes and tables, and grades each one. Click the hidden elements above with it and compare its pick with yours.

Add to Chrome