Get the screen coordinates of an element so a native click can target it
browser_element_screen_coordsReturn an element's on-screen pixel centre for native input drivers, so OS-level clicks and drags land on target when synthesised DOM events are ignored.
Instructions
Return the on-screen pixel centre of an element, for handing to a native input driver (Cua, SendInput). MEASURED: compute it as mozInnerScreenX/Y + getBoundingClientRect() centre, WITHOUT multiplying by devicePixelRatio — mozInnerScreen* is already in screen pixels, and scaling it again puts the cursor far off target. This exists because some browser features only react to genuine OS-level input — the DevTools eyedropper and HTML5 drag-and-drop both ignore synthesised DOM/WebDriver events, but respond normally to a real SendInput click or drag.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context | No | Tab: a browsing context id, or any fragment of the tab URL (default: the active tab) | |
| offsetX | No | Pixels added to the centre X | |
| offsetY | No | Pixels added to the centre Y | |
| selector | Yes | CSS selector of the element |