Antibot

Experimental Scrapfly

Dependencies: Accessibility, Page

Commands

Antibot.performAction

Scrapfly

Performs an accessibility action on a node identified by AXNodeId.
Retries automatically (up to 10 times at 200ms intervals) for OOPIFs
where the browser-side AX tree may take time to populate.

Parameters
Name Type Description
axNodeId Accessibility.AXNodeId
action string AX action to perform. Currently only "doDefault" is implemented.
frameId (optional) Page.FrameId Frame containing the target node. If omitted, uses the main frame.
metadata (optional) string
Return Object
Name Type Description
success boolean
errorMessage (optional) string

Antibot.findAndPerformAction

Scrapfly

Searches the browser-side AX tree across ALL frames (including OOPIFs)
for a node matching the selector, then performs the specified action.
Only "role" and "axNodeId" selector types are supported.
For "role" type, query is the AX role (e.g. "checkbox", "button")
and the browser walks all frames' AX trees. This works for OOPIF
frames where CDP Accessibility.getFullAXTree cannot reach
cross-process nodes.
Retries up to 40 times at 300ms intervals (~12s) if no match found.

Parameters
Name Type Description
selector Selector Only "role" and "axNodeId" selector types are supported.
action string AX action to perform. Currently only "doDefault" is implemented.
name (optional) string Optional AX accessible name substring to match. Filters matched
nodes by their accessible name. Works with both role and axNodeId.
frameUrl (optional) string Optional frame URL glob pattern to restrict search (e.g. "*cloudflare.com*").
Return Object
Name Type Description
success boolean
errorMessage (optional) string
foundNodeId (optional) string The AX node ID that was found and acted upon.
foundRole (optional) string The role of the found node.
foundName (optional) string The name of the found node.

Antibot.moveTo

Scrapfly

Moves mouse to target with human-like Bezier curve trajectory.
Includes natural jitter and distortion to mimic hand tremor.
For non-steady moves greater than 50px, there is a 30% chance of
overshooting by 3-12px then correcting back.
Supports all selector types except bottom.

Parameters
Name Type Description
selector Selector
relativePosition (optional) Coordinate Position within element bounds as ratio [0-1] for each axis.
Default: random position within 0.2-0.8 of bounds.
absoluteOffset (optional) boolean For "coord" selector type only: if true, treat the query coordinates
as an offset from the current mouse position rather than absolute
viewport coordinates. Default: false.
steady (optional) boolean If true, reduces curve deviation and distortion, and disables overshoot.
Use for small or precise targets where accuracy matters. Default: false.
Return Object
Name Type Description
success boolean
errorMessage (optional) string

Antibot.clickOn

Scrapfly

Moves to target then clicks with human-like timing.
Supports all selector types except bottom.

Parameters
Name Type Description
selector Selector
relativePosition (optional) Coordinate
button (optional) string Mouse button: "left", "right", or "middle". Default: "left".
clickDuration (optional) number Hold duration in seconds between mousedown and mouseup.
Default: random between 0.1 and 0.4 seconds.
clickCount (optional) integer Number of clicks (e.g. 2 for double-click). Default: 1.
Return Object
Name Type Description
success boolean
errorMessage (optional) string

Antibot.dragAndDrop

Scrapfly

Drag from source to destination with human-like Bezier movement.
Supports all selector types except bottom.

Parameters
Name Type Description
from Selector
to Selector
fromRelativePosition (optional) Coordinate Position within source element bounds as ratio [0-1]. Default: center area.
toRelativePosition (optional) Coordinate Position within destination element bounds as ratio [0-1]. Default: center area.
Return Object
Name Type Description
success boolean
errorMessage (optional) string

Antibot.clickAndHold

Scrapfly

Moves to target element, presses mouse down, holds for a minimum time,
then releases. Used for captcha puzzles requiring long-press interactions.
Supports all selector types except bottom.

Parameters
Name Type Description
selector Selector
relativePosition (optional) Coordinate
holdTime (optional) number Minimum hold duration in seconds. Default: random between 1.0 and 3.0.
button (optional) string Mouse button: "left", "right", or "middle". Default: "left".
frameUrl (optional) string Frame URL glob pattern to restrict element search to matching frames.
Uses shell-style wildcards (e.g. "*cloudflare.com*", "*recaptcha*").
Return Object
Name Type Description
success boolean
errorMessage (optional) string

Antibot.clickAndSlide

Scrapfly

Moves to target element, presses mouse down, slides the mouse
to a target position, then releases.
Used for slider captcha puzzles.
Supports all selector types except bottom.

Two modes:
1. Fixed distance: provide "distance" in CSS pixels.
2. Target selector: provide "target" selector — the command resolves
both source and target positions and computes the slide distance
automatically with slight human-like imprecision.
At least one of "distance" or "target" must be provided.

Parameters
Name Type Description
selector Selector
relativePosition (optional) Coordinate
distance (optional) number Horizontal slide distance in CSS pixels (positive = right, negative = left).
target (optional) Selector Target element selector — the command slides from "selector" to "target".
Distance is computed automatically with human-like imprecision.
targetRelativePosition (optional) Coordinate Position within target element bounds as ratio [0-1].
verticalOffset (optional) number Vertical slide offset in CSS pixels. Default: 0 (horizontal only).
button (optional) string Mouse button: "left", "right", or "middle". Default: "left".
frameUrl (optional) string Frame URL glob pattern to restrict element search to matching frames.
Uses shell-style wildcards (e.g. "*captcha*").
overshoot (optional) boolean If true, overshoot past the destination on the X axis by 5-15px then
correct back. Simulates a human dragging past the slider endpoint
(captcha sites typically clamp the slider position). Default: false.
Return Object
Name Type Description
success boolean
errorMessage (optional) string

Antibot.scroll

Scrapfly

Human-like scroll. Three modes:

1. Element into view: provide selector (css/xpath/axNodeId/coord/role).
Scrolls until element is within 20% of viewport center, using wheel
events in 3-8 steps. Skips if already visible near center.

2. Scroll to bottom: provide selector {type:"bottom", query:""}.
Scrolls 0.5-0.9x viewport height per step, 3-8 wheel events with
50-150ms delays. If mouse is near origin, first moves it to a random
position with a Bezier curve. Returns atBottom=true when scrollY is
within 5px of the maximum scroll offset.

3. Manual delta: provide delta (no selector). Scrolls by the given pixel
offset using 3-8 wheel steps.

Supports all selector types including bottom.

Parameters
Name Type Description
selector (optional) Selector Target element to scroll into view, or {type:"bottom", query:""} to
scroll toward page bottom.
delta (optional) Coordinate Manual scroll delta in CSS viewport pixels. x = horizontal, y = vertical.
Negative y = scroll down, positive y = scroll up.
Return Object
Name Type Description
success boolean
errorMessage (optional) string
atBottom (optional) boolean True when the page is at or near the bottom (within 5px of max scroll).
Only set when selector type is "bottom".

Antibot.typeText

Scrapfly

Types text character by character with human WPM timing model.
Uses profile-aware keyboard mapping for correct key codes.
Timing: base_delay = 60 / (wpm * 5) seconds per keystroke, with
per-character random variation, common bigram speedup, space pauses,
and shift penalty for uppercase characters.

Parameters
Name Type Description
text string
wpm (optional) number Words per minute. Default: 60. Typical human range: 30-80.
At 60 WPM: ~200ms base delay between keystrokes.
At 30 WPM: ~400ms. At 120 WPM: ~100ms.
Return Object
Name Type Description
success boolean
errorMessage (optional) string

Antibot.fill

Scrapfly

Clicks on element, optionally clears it, then types text with human timing.
Supports all selector types except bottom.

Parameters
Name Type Description
selector Selector
text string
relativePosition (optional) Coordinate
clear (optional) boolean Clear existing content first by sending Ctrl+A then Backspace.
Default: false.
wpm (optional) number Words per minute for typing. Default: 60. See typeText for timing details.
Return Object
Name Type Description
success boolean
errorMessage (optional) string

Antibot.showCursor

Scrapfly

Injects a debug cursor overlay (red dot + trail) for visual testing.
Persists across navigations — re-injected automatically on page load.

Return Object
Name Type Description
success boolean
errorMessage (optional) string

Antibot.getFrames

Scrapfly

Returns all frames including OOPIFs with their metadata.
Uses ForEachRenderFrameHost to enumerate every frame in the page,
including cross-origin out-of-process iframes.

Return Object
Name Type Description
frames array<FrameInfo>

Antibot.locateElement

Scrapfly

Locates an element in a specific frame and returns its bounding box
in main-frame viewport coordinates (CSS pixels). This allows clicking
on elements inside OOPIFs with correct screen-space coordinates.
Only "css", "xpath", and "axNodeId" selector types are supported.

Parameters
Name Type Description
frameId Page.FrameId
selector Selector Only css, xpath, and axNodeId selector types are supported.
relativePosition (optional) Coordinate
Return Object
Name Type Description
success boolean
errorMessage (optional) string
pointX (optional) number Resolved click point in viewport coordinates.
pointY (optional) number
boundsX (optional) number Element bounding box in viewport coordinates.
boundsY (optional) number
boundsWidth (optional) number
boundsHeight (optional) number

Antibot.locateElementAcrossFrames

Scrapfly

Locates an element across ALL frames (main + iframes/OOPIFs).
Tries main frame first, then walks child frames until found.
Returns bounding box in main-frame CSS viewport coordinates.
Supports css, xpath, axNodeId, coord, and role selector types (not bottom).

Parameters
Name Type Description
selector Selector Supports css, xpath, axNodeId, coord, and role types. Not bottom.
relativePosition (optional) Coordinate
Return Object
Name Type Description
success boolean
errorMessage (optional) string
pointX (optional) number
pointY (optional) number
boundsX (optional) number
boundsY (optional) number
boundsWidth (optional) number
boundsHeight (optional) number

Antibot.waitForElement

Scrapfly

Waits for a selector to appear in any frame (main + iframes/OOPIFs).
Polls natively via Mojo every 200ms (no JS execution). Searches main
frame first, then child frames on each poll cycle.
Supports css, xpath, axNodeId, coord, and role selector types (not bottom).

Parameters
Name Type Description
selector Selector
timeout (optional) integer Timeout in milliseconds. Default: 10000 (10s).
visible (optional) boolean If true, also checks that the element has non-zero bounding box
dimensions (width > 0 and height > 0). Note: does NOT check CSS
visibility, display, or opacity properties.
Default: false (just checks existence in the DOM).
Return Object
Name Type Description
success boolean
errorMessage (optional) string
frameId (optional) Page.FrameId Reserved for future use. Currently always null.

Antibot.getMousePosition

Scrapfly

Returns the current tracked mouse position in CSS viewport pixels.

Return Object
Name Type Description
x number
y number

Antibot.isElementVisible

Scrapfly

Checks whether an element is visible in the viewport.
Only "css" and "xpath" selector types are supported.
Searches main frame first, then child frames (iframes/OOPIFs).
Visibility is determined by the renderer (checks display, opacity,
dimensions, and viewport intersection).

Parameters
Name Type Description
selector Selector Only css and xpath selector types are supported.
Return Object
Name Type Description
visible boolean
exists (optional) boolean True if element exists in the DOM but is hidden (not visible).
reason (optional) string Human-readable reason when not visible (e.g. "zero size", "off viewport").

Antibot.pressKey

Scrapfly

Sends a single key press with human-like timing (keyDown + keyUp,
30-70ms hold duration).

Special key names (case-insensitive):
"Enter", "Tab", "Escape" (or "Esc"), "Backspace", "Delete",
"Space", "Home", "End", "PageUp", "PageDown",
"ArrowUp" (or "Up"), "ArrowDown" (or "Down"),
"ArrowLeft" (or "Left"), "ArrowRight" (or "Right")

Single characters: any single character (e.g. "a", "A", "1", "@").
Shift is applied automatically when the character requires it.

Modifier combos: prefix with "Ctrl+", "Shift+", "Alt+", or "Meta+"
(case-insensitive). One modifier prefix per call.
Examples: "Ctrl+a", "Ctrl+c", "Ctrl+v", "Shift+Tab", "Alt+F4"

Parameters
Name Type Description
key string Key name, single character, or modifier combo. See above for accepted values.
Return Object
Name Type Description
success boolean
errorMessage (optional) string

Antibot.hover

Scrapfly

Moves mouse to element with human-like trajectory and pauses
briefly to trigger hover states (CSS :hover, tooltips, menus).
Supports all selector types except bottom.

Parameters
Name Type Description
selector Selector
relativePosition (optional) Coordinate
holdTime (optional) integer How long to hold the hover position in milliseconds.
Default: random between 500 and 1500ms.
Return Object
Name Type Description
success boolean
errorMessage (optional) string
: clicks the element, then selects the option via the browser's native popup. fires change/input events. for custom dropdowns (bootstrap, react select, mui, etc.): provide optionselector — the command will click the trigger to open the dropdown, find the matching option element, and click it. matching: provide exactly one of value, text, or index. for native
esc to close