In Selenium, how do you use the element named in an element click intercepted message to find the cause?
answer
- The message is a diagnosis, not noise
- Identify the covering element, then ask why
- Sticky chrome, toast, or modal backdrop
- Coordinates say where it collided
- getRawMessage strips the appended build info
basics
~20 sRead the interceptor's tag out of the message, then find that element in the application and ask why it was there at that moment. Its identity separates fixed page chrome, a leftover toast, and an open dialog.
solid answer
~40 sThe interceptor tag in the message is a diagnosis, not noise. Chromium's drivers print the intercepting element's opening tag with its children collapsed to an ellipsis, so its `id` and `class` are visible, and `<div class="press-status-bar">`, `<div class="job-toast">` and `<div class="plate-modal-backdrop">` are three different bugs. Sticky chrome means the queue row scrolled under the page header and the click landed on the header. A toast means an earlier step's confirmation is still on screen. A backdrop means a dialog the test believed closed is still open, which is an application-state error rather than a timing one. Use `getRawMessage()` to read the driver's text without Selenium's appended build and system information, and note the coordinates too: they say where in the viewport the collision happened.
code
java · 10 linesWebDriver driver = new ChromeDriver();
driver.get("https://press-console.example/queue");
try {
driver.findElement(By.id("release-plate")).click();
} catch (ElementClickInterceptedException e) {
String raw = e.getRawMessage() == null ? "" : e.getRawMessage();
Matcher m = Pattern.compile("Other element would receive the click: (<[^>]+)").matcher(raw);
System.out.println(m.find() ? "Interceptor: " + m.group(1) : raw);
}
driver.quit();go deeper
Be ready to find the interceptor's tag inside the message and say which element it is. Knowing the message contains that answer already separates you from a candidate who only reports the exception name.
Explain what the parts of the message mean: the target's own tag echoed back, the coordinates of the collision, and the intercepting element's opening tag with its children collapsed to an ellipsis.
An interviewer expects you to map interceptor identity onto distinct causes, such as fixed page chrome over the current scroll position, a leftover confirmation, or an open dialog backdrop, and to argue which of them is an application defect.
Own the boundary you set for teams: which interceptions the application must stop producing because a real user would hit them too, and which are artefacts of how the harness drove the page there.
## The message is the diagnosis, not decoration An intercepted click reports the same exception type no matter what covered the element, so the exception name alone tells you almost nothing actionable. What separates one cause from another is the **tag named inside the message**. In Selenium 4 the driver hit-tests the target's in-view centre point and reports what it found there, and Chromium's drivers spell it out: ``` Element <button id="release-plate">...</button> is not clickable at point (612, 88). Other element would receive the click: <div class="press-status-bar">...</div> ``` Each tag is the element's `outerHTML` with its `innerHTML` collapsed to an ellipsis, so the `id`, `class` and other attributes survive while the children do not. Read that second tag first — it is the only part of the failure that identifies the actual cause. ## Anatomy of the message - **The first tag** is your target, echoed back. Confirms the locator found what you meant. - **The coordinates** are the target's in-view centre point in the viewport. A y of `88` says the collision happened near the top of the window; a y near the bottom implicates something anchored there. - **The tag after `Other element would receive the click:`** is the element painted at that pixel — the interceptor. - **The appended `Build info`, `System info` and `Session ID`** come from Selenium's `WebDriverException.getMessage()`, not from the driver. `getRawMessage()` returns the driver's text alone, which is what you want when you are pulling the interceptor out programmatically. ## What each kind of interceptor tells you | Interceptor named in the message | What it means | Where the fault sits | |---|---|---| | Fixed or sticky page chrome, e.g. `<div class="press-status-bar">` | the target scrolled under permanent chrome | page geometry and scroll position | | A transient confirmation, e.g. `<div class="job-toast">` | feedback from a previous step is still on screen | the ordering of the steps | | A dialog backdrop, e.g. `<div class="plate-modal-backdrop">` | a modal the test believed closed is still open | application state is wrong | | A full-viewport spinner or blocking layer | the console is still busy with the previous command | application state is wrong | | A descendant of the target itself | not an interception at all | the locator could be more precise | The last row matters because it is easy to misread. The Chromium click atom treats a **descendant** at the centre point as a legitimate hit and returns clickable, adding only the warning text `Element's descendant would receive the click.` The click succeeds and the event bubbles to your target, so nothing fails. ## A procedure that works 1. Catch the exception and read `getRawMessage()`, so the driver's own wording is not buried in appended build information. 2. Extract the tag after `Other element would receive the click:` and note the coordinates alongside it. 3. Find that `id` or `class` in the application's own markup and name the component it belongs to — chrome, toast, backdrop, spinner. 4. Ask whether a real user at that viewport size and scroll position would meet the same obstruction. If yes, the console has a defect: an overlay is stealing clicks from a control. If no, the harness put the page into a state a user would not reach. 5. Only then choose the mechanism you use to get past it. Waiting for the overlay to clear and forcing the click through injected script are separate decisions, and both are only sound once you know which element you are dealing with. ## The two messages that are not interceptions - **No `Other element` clause at all.** When `elementFromPoint` returns nothing, the atom prints only `Element is not clickable at point (x, y)`. Nothing is covering the target; its centre point is outside the viewport or under a rendered scrollbar. The problem is geometry. - **`Element's descendant would receive the click.`** As above, this is a warning attached to a *successful* click, not a failure. Treating it as an interception sends you hunting for an overlay that does not exist. ## Do not turn the text into control flow The W3C specification fixes only the error code `element click intercepted` and its HTTP status of **400**. The `message` field is free-form, and drivers word it differently — the Selenium test suite for .NET even asserts on the string as an option rather than a certainty. So: - **Branch on the exception class**, which is stable across every driver and binding, never on a substring of the message. - **Read the message yourself** when diagnosing a failure; it is written for a human, not for a parser. - If you do extract the interceptor's tag mechanically, guard for the case where the pattern does not match, because on a non-Chromium driver it will not. Two clicks that both fail with `ElementClickInterceptedException` in a print queue can be a cosmetic scroll-position artefact and a modal that never closed. The class does not distinguish them; the tag inside the message does.
- What does a message with no Other element clause tell you?That the hit test found nothing painted at the centre point. The Chromium atom prints only `Element is not clickable at point (x, y)` when `elementFromPoint` returns null. That usually means the target's centre point sits outside the viewport or under a rendered scrollbar, so the geometry is wrong rather than an overlay being present.
- Why is Element's descendant would receive the click not an error?Because the Chromium click atom Selenium ships treats a descendant at the centre point as a legitimate hit and reports the element as clickable, adding that text only as a warning. The click goes through and the event bubbles to your target, so nothing fails; it is a hint that the locator could be more precise.
- Should a test match on the message text to decide what to do?No. The W3C specification fixes only the error code and its status; the `message` field is free text and every driver words it differently. Branch on the exception class, and treat the message as human-readable diagnosis that you read yourself when investigating.
saying these in an interview costs you the question
- Retries the click without reading which element intercepted it
- Assumes every interception is a timing problem with the same fix
- Reads the coordinates but never looks up the named tag
- Treats a message with no Other element clause as an overlay
- Parses driver message text to drive control flow in tests