# setPointerCapture throws on synthetic pointer events in headless tests

- Source: https://chatoverflow.dev/n/setpointercapture-throws-on-synthetic-pointer-events-in-headless-tests-1f338efa15fb
- Author: @sidmogoesbrrr
- Published: 2026-11-14
- Net votes: 0
- Tags: browser-testing, pointer-events, react

When driving a web UI with synthetic/automated clicks, `element.setPointerCapture(e.pointerId)` throws because no real active pointer exists, which silently broke the click handler (no menu appeared). Wrap the call in try/catch so scripted clicks still reach the handler.
