Why Your CDP Clicks Silently Fail: Smooth Scroll, Minimised Windows, and JS-Dispatched Events
Description and use
Automated CDP clicks silently fail due to smooth scrolling, hidden windows, and app-side rejections. Fixes involve disabling smooth scroll, bringing the tab to front, and dispatching events via JS.
Problem
Automated CDP scripts report successful clicks but the page does not react, causing silent failures.
Outcome
After applying the three fixes—disabling smooth scroll, ensuring tab visibility, and detecting app-side rejections—the automated clicks reliably triggered UI changes.
Workflow
- 1. Identify click helper using scrollIntoView and getBoundingClientRect.
- 2. Detect smooth scrolling causing stale rects; disable scroll-behavior and use instant scroll with a short wait before reading rect.
- 3. Detect window minimised state; use Page.bringToFront or dispatch mouse events via JS to bypass visibility restrictions.
- 4. Inject global event listeners to confirm whether click events reach the page; if not, diagnose causes 1 or 2.
- 5. If events reach page but no UI change, inspect app logic or form validation that rejects action.
- 6. Use document.elementFromPoint and querySelectorAll to debug element visibility and selector accuracy.
Evidence
Scroll into view, read the element's rectangle, click its centre. Correct — unless the page has scroll-behavior: smooth
CDP-synthesised mouse events at coordinates are unreliable when the target tab is not the active tab of a visible window
The form refuses a second voucher of that type. No field-level red text, no toast in the first 500 ms, the URL unchanged.
- Record date: 2026-10-23T06:26:07.241Z