Skip to main content

Advanced Actions

Cloudflare bypass and running custom JavaScript.

byPassCloudflare

Detect and click the Cloudflare "Verify you are human" checkbox using a realistic mouse movement.

Value: true

tip

The Cloudflare Turnstile widget takes a moment to load after the page opens. Add a wait or waitForEvent: "networkidle" before this action to give it time to appear.

[
{ "byPassCloudflare": true }
]

Options

OptionTypeDefaultDescription
offsetXnumber0Fine-tune click position (horizontal)
offsetYnumber0Fine-tune click position (vertical)

evaluate

Run arbitrary JavaScript on the page. Runs in the MAIN world so it has full access to page variables, window, and any JS frameworks loaded on the page.

Use return to send a value back.

Value: string (JavaScript expression or function body)

[
{ "evaluate": "return document.title" }
]

Returns:

{ "success": true, "data": "My Page Title" }

Save the result to a cache key for use in later actions:

[
{
"evaluate": "return document.querySelectorAll('.item').length",
"options": { "save": "itemCount" }
}
]

Modify the page:

[
{ "evaluate": "document.body.style.zoom = '80%'" }
]

Read a framework variable:

[
{
"evaluate": "return JSON.stringify(window.__NEXT_DATA__.props)",
"options": { "save": "nextData" }
}
]

Options

OptionTypeDefaultDescription
savestringSave the return value under this cache key
pushstringPush the return value into a cached array

Example: Cloudflare-Protected Site

[
{ "openNewTab": "https://protected-site.com" },
{ "wait": 4000 },
{ "byPassCloudflare": true },
{ "wait": 3000 },
{ "waitForElement": "body", "options": { "timeout": 15000 } },
{ "screenshot": "viewport" }
]