Task Progress0 of 4 Tasks
0%

Click Traps

Elements that are covered, moving, stacked under other layers or not yet enabled. Never force the click: the point is to wait for, or remove, whatever is in the way. Each task ticks itself when its result box turns green.

1.Overlapped element

Covered buttonTo do
The button is covered — get rid of the cover first
Goal

The Submit Order button is under a banner. Dismiss the banner, then click the button.

2.Moving button

Click after it stopsTo do
Start the animation, then click the button
Goal

Start the animation, then click “Catch me” only once it has stopped sliding.

3.Hidden layers

Stacked buttonsTo do
Click the green button
Goal

Click the green button once. Then prove that a blue copy now sits on top of it.

4.Disabled → enabled

Input that enables laterTo do
Enable the input, type QA and submit
Goal

Click “Enable input”, wait for the field to become enabled (2 to 4 seconds), type QA and submit.

5. Solutions

Try the challenges yourself first. Reference solutions are hidden until you ask for them.

About this Click Traps page

A click trap is an element that is visible but cannot receive a click, because another element covers it, it is still moving, or it is not enabled yet. Selenium reports this as ElementClickInterceptedException and Playwright retries until it times out. You practice by reproducing each trap, then fixing it with actionability waits, scrolling, or closing the overlay instead of forcing the click.

Screenshot of the Click Traps practice page on QA Playground. Covered, moving and delayed elements that break naive clicks.
Click Traps: Covered, moving and delayed elements that break naive clicks.

Frequently asked questions

What does ElementClickInterceptedException mean in Selenium?

It means the browser found the element, but another element would receive the click at that point, such as a modal, sticky header or cookie banner. Selenium 4 names the intercepting element in the message. Wait for the overlay to go away, scroll the target into view, or close the overlay.

How does Playwright handle a covered element?

Playwright runs actionability checks before click: visible, stable, enabled, and receives events. If another element intercepts pointer events, it retries until the timeout, then fails with a log naming the blocker. Dismiss the overlay or wait for it to detach rather than using force: true.

Should I use a JavaScript click to get around a click trap?

Usually not. A JavaScript click skips the checks a real user hits, so it can pass while the button is unusable. Use it only when the element is genuinely clickable but the driver misreports it, and say why in a comment.

How do I click an element that is moving?

Wait until the element is stable. Playwright does this automatically by checking that the bounding box is unchanged across two animation frames. In Selenium and Cypress, wait for the animation to finish or for a class or position change, then click.

How do I test a button that is disabled or delayed?

Assert or wait for the enabled state before clicking. Use expect(button).toBeEnabled() in Playwright, an ExpectedConditions.elementToBeClickable wait in Selenium, or should('not.be.disabled') in Cypress. Avoid fixed sleeps, which are slow and still flaky.

Free developer tools on Randomly.online

QA Playground is part of Randomly.online. These tools help while you write and debug tests: