Session Actions
This page defines all of the built in session scoped actions.
$
Selects a single element using the provided CSS selector and scopes all nested actions to that element. Any nested evaluators or actions will operate relative to this selection.
selector: The CSS selector. Can be a static string or expression.
$ "#search-input" { type "Tadpole HQ" mouse.press "Enter"}Selects all elements matching the provided CSS selector. This creates a collection context.
selector: The CSS selector. Can be a static string or expression.
$$ ".result-card" { extract "results" { title { text } link { attr "href" } }}apply_identity
Section titled “apply_identity”Applies a new identity for the provided platform. It will always use Chrome/Chromium. It will also
override any high entropy user agent metadata headers.
platform: The platform to generate the identity for. Options arewindows,macandlinux.
Options
Section titled “Options”limit: The number of recent browser releases to consider. It is better to keep this value lower if stealth is required. Defaults to3.
apply_identity windows // This will apply a Windows UA using a recent browser releaseClicks on the active element. It uses a natural movement (bezier curve) to hover the mouse over the element and optionally delay before clicking the target.
Options
Section titled “Options”delay: The delay between hovering and clicking the target. Can be a static number or expression. Defaults to0.mouseclick.*: Prefixed options. Seemouse.clickoptionshover.*: Prefixed options. Seehoveroptions
$ "#submit-button" { click delay="=gauss(0.5, 0.25)"}Executes the children nodes. Can be conditional by providing if and can be repeated by providing n.
Options
Section titled “Options”if: The execution condition. Can be an expression. Defaults toundefined.n: The number of times to execute the body. Defaults to1.
do if="=env('CHECK_SOMETHING')" { ...}
do n=3 { ...}extract
Section titled “extract”Extracts data from the current element context into a structured record (JSON). Each child node of extract defines a key in the resulting object and the evaluator(s) used to fetch its value.
path: The target key or dot-delimited path (e.g.,user.profile) where the record will be stored in the global state. Supports static strings or expressions.
Children
Section titled “Children”The name of each child node becomes a key in the output record. The children of these nodes are evaluators because we need to produce a value.
$$ ".product-card" { extract "products" { title { text } price { $ ".amount" text } details { attr "data-info" } }}// Output: {"products": [{"title": "...", "price": "...", "details": "..."}, ...]}Usage (nested path)
Section titled “Usage (nested path)”$ ".header" { extract "metadata.page" { title { text } url { attr "href" } }}// Output {"metadata": {"page": {"title": "...", "url": "..."}}}for_each
Section titled “for_each”Iterates over a collection of elements selected by a parent $$ block.
This action is required when you need to perform individual interactions (like click or hover) on every item in a list.
$$ ".result-item" { for_each { $ "button.expand" { click } }}Uses a combination of an ease-out function to scroll and a bezier curve to move the mouse over the active element.
Options
Section titled “Options”move.*: Prefixed options. Seemouse.moveoptionsscroll.*: Prefixed options. Seemouse.natural_scrolloptions
Navigates the current browser tab to a specified URL.
url: The url to navigate to. Can be a static string or expression.
Options
Section titled “Options”wait_until: The event to wait for after navigating (loadordomcontentloaded). Defaults toload.timeout: The timeout (in ms) for thewait_untilevent to fire. Defaults to5000. Can be a static number or expression.
Executes the actions in the do and next child nodes while the evaluators in the if child node return a truthy value.
The actions in do are executed before the check and the actions in next are executed only if the check returns a truthy value.
Options
Section titled “Options”some: If the active node is a collection, return true if at least one element meets the predicate.
loop { do { extract "data[]" { ... } } while { $ "#pagination-next"; prop disabled; as_boolean; not } next { $ "#pagination-next" { click } wait_until }}Allows the children nodes to throw an exception. This is useful when there are instances when some event may or may not fire, i.e a dialog appearing to signup for a newsletter.
maybe { wait_for "#dialog" $ "#dialog .close-button" { click }}Executes the action in the do node if the evaluators in the if node evaluate to true.
once { if { $ "#username" } do { $ "#username" { type "=env('USERNAME')" } $ "#password" { type "=env('PASSWORD')" } $ "button[type='submit']" { click } }}parallel
Section titled “parallel”Executes the children node in parallel.
parallel { screenshot loading wait_for "#form" wait_for ".container"}random
Section titled “random”Executes only one of the children nodes. This action supports weights.
Options
Section titled “Options”weights: A comma separated list of integers representing the weight of its corresponding child. Defaults toundefined.- If the length of weights is less than the children nodes, the weight defaults to
1. - They do not need to add up to
100or1.0, the relative probability is automatically calculated.
- If the length of weights is less than the children nodes, the weight defaults to
// Select windows 95% of the time, linux 5% of the timerandom weights="95,5" { apply_identity windows apply_identity linux}screenshot
Section titled “screenshot”Takes a screenshot and saves it to the provided path.
path: The path to save to. Can be a static string or expression.
Options
Section titled “Options”format: The format to save the screenshot in. Options arejpeg,pngandwebp. Default topng.quality: If using jpeg, the image quality between 0 and 100. Defaults to100.clip.: Prefixed options to clip the screenshot. Clipping is enabled if any of these values are passed.x: The x offset. Defaults to 0.y: The y offset. Defaults to 0.width: The width. Defaults to 1280.height: The height. Defaults to 720.scale: The scale factor. Defaults to 1.
screenshot "path/to/file"screenshot "path/to/file" format=jpegscreenshot "path/to/file" clip.x=100 clip.y=100 clip.width=100 clip.height=100set_device_memory
Section titled “set_device_memory”Overrides the reported device memory in the user agent metadata headers.
memory: The device memory report (in GB)
set_device_memory 8set_hardware_concurrency
Section titled “set_hardware_concurrency”Overrides the reported hardware concurrency.
concurrency: The hardware concurrency to report.
set_hardware_concurrency 4set_viewport
Section titled “set_viewport”Overrides the viewport metrics.
width: The viewport width.height: The viewport height.
Options
Section titled “Options”deviceScaleFactor: The scale factor. Defaults to1.mobile: Whether to emulate a mobile device. Defaults tofalse.screenWidth: The screen width. Defaults towidth(emulating full screen).screenHeight: The screen height. Defaults toheight(emulating full screen).
set_viewport 1920 1200 // maximizedset_viewport 1920 1200 screenHeight=1009 // accounts for top barset_webgl_vendor
Section titled “set_webgl_vendor”Overrides the reported WebGL vendor and renderer.
vendor: The WebGL vendor to report.renderer: The WebGL renderer to report.
set_webgl_vendor "Google Inc. (Intel)" "ANGLE (Intel, Intel(R) UHD Graphics 620 Direct3D11 vs_5_0 ps_5_0)"set_webgl_vendor "Apple Inc." "Apple M1"Clicks on the active element and types in the provided text.
It uses hover internally so it uses the same combination of an ease-out function to scroll
and a bezier curve to move the mouse.
text: The text to type. Can be a static string or expression.
Options
Section titled “Options”delay: The delay between clicking the target and typing. Can be a static number or expression.click.*: Prefixed options. Seeclickoptionskeyboardtype.*: Prefixed options. Seekeyboard.typeoptions
wait_for
Section titled “wait_for”Waits for the children evaluators to return true. This is useful to wait for the addition/deletion of
elements/attributes as internally it uses Mutationobserver.
Options
Section titled “Options”timeout: The maximum amount of time to wait for the evaluators to returntrue(in ms). Defaults to5000.
wait_for { $ "div[role='dialog']" }$ "div[role='dialog'] button" { click }wait_for { $ "div[role='dialog']"; not }wait_until
Section titled “wait_until”Waits until the specified browser event fires.
event: The event to wait for. Defaults toload.loaddomcontentloadednetworkIdlenetworkAlmostIdle
Options
Section titled “Options”timeout: The maximum amount of time to wait for the provided event to fire (in ms). Defaults to5000.
$ "#some-link" { click }wait_until