Expand description
Native CDP input and geometry for ref-based interaction.
Every function here works on an already-attached flat session (see
crate::session::cdp_session::with_page_session) and a CDP
backendDOMNodeId, which is what an element ref resolves to. Clicks go
through Input.dispatchMouseEvent at the element’s centre in viewport
CSS pixels — the coordinate space DOM.getContentQuads already reports
in, so no device-pixel-ratio maths is involved. Text goes through
Input.insertText, which fires the same beforeinput/input events a
paste does (Playwright’s fill does the same).
Deliberately not done in v1: occlusion checks (a click on a covered
element lands on the overlay), auto-waiting, and Page.bringToFront
(input works on background tabs, and the project keeps automated tabs
in the background).
Structs§
- Point
- A point in viewport CSS pixels.
Functions§
- click
- Left-click the node’s centre.
- document_
token - The Document node’s
backendNodeId: changes on every navigation, so it identifies “the document the refs were taken from”. - drag
- Pointer-event drag from one node’s centre to another’s. HTML5 native
drag-and-drop (
draggable) needsInput.setInterceptDrags; not in v1. - hover
- Move the pointer over the node’s centre.
- node_
center - Scroll the node into view and return its clickable centre.
- node_
clip_ rect - Border box of the node in document coordinates, the same contract as
crate::dom::scripts::GET_CLIP_RECT_JS, for element screenshots. - pick_
point - Pick the centre of the first quad with a visible area after clipping
to the viewport. Mirrors Puppeteer’s
clickablePoint. - press_
enter - Press and release Enter on the focused element.
text: "\r"on the keyDown is what makes Chromium synthesise thekeypressand submit forms, matching Puppeteer. - type_
text - Focus the node, replace its current content with
text, and optionally press Enter.press_sequentiallyinserts one character per event for inputs that react to each keystroke.