WebDriver Element Click Simulation, Errors and Troubleshooting
Why WebDriver and ChromeDriver report elements as not clickable, where clicks land, and how to fix overlays, layout, and timing issues.
This page summarises Google Chrome’s documentation on ChromeDriver click behaviour, especially the clicking issues guide, together with related fixes from the ChromeDriver release notes and the HTML specification’s optional WebDriver extension for user activation.
WebDriver click commands and ChromeDriver
Section titled “WebDriver click commands and ChromeDriver”Browser UI tests usually drive the page through W3C WebDriver commands. For Google Chrome, the typical stack is Selenium (or another client) talking to ChromeDriver, which controls Chrome via the Chrome DevTools Protocol. Classic WebDriver covers familiar commands such as element find and click; WebDriver BiDi is described in Chrome’s automation and testing hub as the cross-browser direction for newer automation, alongside ChromeDriver documentation and design notes on BiDi in ChromeDriver.
For everyday “click this button” failures, the behaviour that matters most is how ChromeDriver chooses coordinates and when it refuses to click.
Where ChromeDriver attempts to click
Section titled “Where ChromeDriver attempts to click”Element click: centre of the first client rect
Section titled “Element click: centre of the first client rect”ChromeDriver does not click arbitrary pixels inside an element unless you use lower-level pointer APIs. For a standard element click, it simulates a mouse click at the middle of the element’s first client rect, or its bounding client rect if there is no first client rect.
ChromeDriver clicking works by simulating a mouse click in the middle of the element’s first client rect (or bounding client rect if it doesn’t have a first client rect). The easiest way to find out where ChromeDriver is attempting to click is to open the chrome devtools and inspect the element to be clicked right before your click operation is called. Select the element in the inspector and notice the blue box(es) representing the client rects of the element, as pictured below. ChromeDriver will attempt to click the middle of the first one.
— Google Chrome, Clicking issues
If that centre is not a point a real user could activate (hidden under another layer, outside a child’s clickable region, off-screen under a fixed bar), ChromeDriver raises Element is not clickable instead of guessing another point.
PerformActions and in-view centre calculations
Section titled “PerformActions and in-view centre calculations”Newer pointer input uses WebDriver PerformActions (move, down, up). Release notes describe alignment with the WebDriver spec when computing the in-view centre of an element: ChromeDriver was updated to ignore overflow: hidden clipping imposed by ancestors when calculating that point, matching other PerformActions scenarios. Pointer moves also gained support for fractional x and y coordinates, which matters for touch and precise pointer tests that previously failed or behaved incorrectly with integer-only moves.
Element is not clickable: what the error means
Section titled “Element is not clickable: what the error means”The Element is not clickable message means the computed click point is not considered user-clickable at click time—not that the locator is wrong or the element is missing from the DOM.
Layout and hit-testing mismatches
Section titled “Layout and hit-testing mismatches”A frequent pattern is targeting a parent while only a child receives hits.
If ChromeDriver is throwing the ‘Element is not clickable’ error, it’s most likely because that location is not actually clickable by the user. To test, place your cursor in the middle of the first client rect yourself and see if that location is clickable.
— Google Chrome, Clicking issues
The clicking issues guide gives a concrete anchor-plus-image example: the anchor’s box center can fall outside the image’s clickable area because of margin-bottom on the image, so the anchor is the wrong target even though a click on the image works.
The ‘Element is not clickable’ error often occurs in the following situations when a test tries to:
Click an anchor whose clickable descendant elements are not within the anchor bounds (as above) Click an element fully or partially under another element Click an element offscreen when a fixed overlay is present (the element will be scrolled into view, but it may be scrolled under the fixed overlay) Click an element that is not clickable in the middle (for example, some types of convex SVG elements)
— Google Chrome, Clicking issues
Common conclusion: treat the error as a geometry and stacking problem first. Confirm the client rect ChromeDriver uses, then match the target to the node that actually receives events (often a child), or adjust/blocking UI before retrying the same locator on the parent.
Timing: position changed between locate and click
Section titled “Timing: position changed between locate and click”The same error string can also mean the element moved after ChromeDriver computed coordinates.
This most likely occurs because the element’s location has changed some time after ChromeDriver determined the element’s location but before ChromeDriver actually issues a click at the location.
— Google Chrome, Clicking issues
Catch the exception, log the element’s current location and size, and compare them to the coordinates in the error. If they differ, wait for layout to stabilise (animations, carousels, lazy content) or retry; if they match, focus on obscured or non-hit-tested centres rather than race conditions.
Moving elements are not a supported click target
Section titled “Moving elements are not a supported click target”Continuous motion is explicitly out of scope for reliable clicking.
This isn’t a supported feature of ChromeDriver. If the element eventually stops, wait for that to occur. If the element never stops moving, ChromeDriver does not guarantee the click will be successful.
— Google Chrome, Clicking issues
Wait for motion to end, stabilise the UI in the test environment, or assert on a steady state before calling click.
How to fix click failures in tests
Section titled “How to fix click failures in tests”Prefer the clickable node and remove blockers
Section titled “Prefer the clickable node and remove blockers”The clicking issues guide lists practical fixes:
- Click a child that owns the hit target (for example the image instead of the wrapping anchor).
- Hide or remove overlays that intercept pointers (cookie banners, modals) when appropriate for the test.
- Use the advanced interactions API to click at an offset from the element’s top-left when the centre is wrong but another point inside the box works.
- Dispatch a click in JavaScript when you are testing application logic rather than real pointer hit testing (know that this skips some browser activation and event-path behaviour).
Choosing between these depends on whether the test must exercise real user input or only application handlers.
Iframes, shadow DOM, and site isolation
Section titled “Iframes, shadow DOM, and site isolation”ChromeDriver release notes document harder cases that plain “scroll and click centre” can miss:
| Scenario | Documented behaviour |
|---|---|
| Cross-origin iframe with a visible overlay | Regression coverage for ElementClick over cross-origin iframes when overlays sit on top in site isolation scenarios, so clicks are not routed into embedded content instead of the overlay. |
| Button inside nested iframe in closed shadow root | DOM access fix when simulating a button click inside an iframe nested in a closed shadow root; frame resolution no longer relies on script that cannot pierce the closed root. |
| Remote frames | Mouse clicks on remote frames route to the highest same-origin ancestor of the target frame rather than only the top frame, reducing racey mis-delivery. |
When clicks “go through” to the wrong document, check frames, shadow roots, and top-layer overlays before blaming selectors.
User activation and automation (HTML extension)
Section titled “User activation and automation (HTML extension)”Some APIs (pop-ups, certain media actions) require transient user activation. For automation and application testing, the HTML specification defines an optional WebDriver extension command; user agents are not required to implement it.
| HTTP method | URI template |
|---|---|
POST |
/session/{session id}/window/consume-user-activation |
The remote end sets consume to true when the active window has transient activation, consumes that activation if present, and returns success with data consume. See HTML — User agent automation (§6.4.5). This is separate from click coordinate logic but relevant when tests assert on gated APIs after programmatic clicks.
Staying current with ChromeDriver
Section titled “Staying current with ChromeDriver”Functional clicking behaviour changes ship with ChromeDriver builds. The ChromeDriver downloads page lists bug fixes and behaviour changes (input, target selection, BiDi, stability). Match ChromeDriver version to the Chrome (or Chrome for Testing) build under test; the automation and testing hub links ChromeDriver docs and WebDriver BiDi references. Puppeteer is an alternate Chrome automation stack; blog posts there sometimes cover Chrome for Testing and BiDi, but click-centre rules discussed here are documented for ChromeDriver specifically.
How to check this on your site
Section titled “How to check this on your site”-
Reproduce the step with DevTools open, select the target node, and note the blue client rect boxes—the centre of the first rect is where ChromeDriver clicks, as described in Clicking issues.
-
Manually place the pointer on that centre and verify whether a real click reaches the control; if not, retry on the child that receives hits or remove the blocking layer.
-
On failure, compare the element’s live
getBoundingClientRect()(or DevTools position) with the coordinates in the exception to separate layout/stacking issues from movement between find and click. -
Confirm Chrome and ChromeDriver versions match the browser binary you automate, using the automation and testing documentation as the entry point.
-
You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact wording you are questioning so it can be checked against the linked Chrome and WHATWG sources.