Basic Usage
All examples use POST https://api.browserworker.app/v1/ with your Bearer token.
curl -X POST https://api.browserworker.app/v1/ \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "actions": [ ... ] }'
Quick Example
[
{ "open": "https://example.com/login" }, // Navigate to website
{ "fill": ["#email", "user@example.com"] }, // Type email
{ "fill": ["#password", "secret123"] }, // Type password
{ "click": "#submit-btn" }, // Click submit button
{ "waitForElement": ".dashboard" }, // Wait for page to load
{ "screenshot": "viewport" } // Take a screenshot
]
Navigation
Open a Page
[
{ "open": "https://example.com" }
]
Open in New Tab
[
{ "openNewTab": "https://example.com" }
]
Close other tabs after opening:
[
{ "openNewTab": ["https://example.com", { "closeOtherTabs": true }] }
]
Set Viewport Size
[
{ "setViewportSize": [1920, 1080] }
]
Interaction
Click
[
{ "click": "#submit-btn" }
]
Fill (Type Text)
[
{ "fill": ["input[name='email']", "hello@example.com"] }
]
Press Key
[
{ "press": "Enter" }
]
With modifiers:
[
{ "press": "Shift+A" }
]
Hover
[
{ "hover": ".menu-item" }
]
Check / Uncheck
[
{ "check": "#agree-checkbox" }
]
[
{ "uncheck": "#agree-checkbox" }
]
Select Option
By value:
[
{ "selectOption": ["select#country", "us"] }
]
By visible text:
[
{ "selectOption": ["select#country", { "label": "United States" }] }
]
Data Extraction
Get Text
[
{ "getText": "h1" }
]
Get HTML
[
{ "getHTML": ".article-body" }
]
Get Attribute
[
{ "getAttribute": ["a.link", "href"] }
]
Get Value
[
{ "getValue": "input[name='email']" }
]
Extract All
Extract text from multiple elements:
[
{ "extractAll": [".product-title", "text"] }
]
Extract an attribute from multiple elements:
[
{ "extractAll": [".product-link", "href"] }
]
Finding Elements
Find (Wait for Element)
[
{ "find": ".dynamic-element" }
]
Find by Text
[
{ "findByText": ["Submit", "button"] }
]
Contains match:
[
{ "findByText": ["Submit", "button", "contains"] }
]
Find by Attribute
[
{ "findByAttribute": ["data-testid", "login-btn"] }
]
Waiting
Wait (Delay)
[
{ "wait": 2000 }
]
Wait for Element
[
{ "waitForElement": ".loaded-content" }
]
With timeout:
[
{ "waitForElement": [".loaded-content", { "timeout": 10000 }] }
]
Wait for Page Load
[
{ "waitForLoad": true }
]
Wait for Network Idle
[
{ "waitForEvent": "networkidle" }
]
Scrolling
Scroll Vertically
Scroll down 500px:
[
{ "scrollY": 500 }
]
Scroll to bottom:
[
{ "scrollY": "bottom" }
]
Scroll Horizontally
[
{ "scrollX": 300 }
]
Screenshot
Capture viewport:
[
{ "screenshot": true }
]
Capture full page:
[
{ "screenshot": "fullpage" }
]
Capture a specific element:
[
{ "screenshot": "#chart" }
]
File Upload
[
{ "uploadFile": ["input[type='file']", "my-file.pdf"] }
]
Send the file as multipart/form-data with your request. The file field name should match the filename used in the action.
Cookies
Get Cookies
[
{ "getCookies": "https://example.com" }
]
Set Cookies
[
{ "setCookies": [{ "url": "https://example.com", "name": "token", "value": "abc123" }] }
]
Delete a Cookie
[
{ "deleteCookie": { "url": "https://example.com", "name": "token" } }
]
Clear All Cookies
[
{ "clearCookies": true }
]
Advanced
Evaluate JavaScript
[
{ "evaluate": "document.title" }
]
Return a value:
[
{ "evaluate": "document.querySelectorAll('.item').length" }
]
Human-like Click
[
{ "clickHuman": "#button" }
]
Fast mode (starts cursor closer to target):
[
{ "clickHuman": ["#button", { "mode": "fast" }] }
]
Human-like Hover
[
{ "hoverHuman": ".element" }
]
Bypass Cloudflare
[
{ "byPassCloudflare": true }
]
Wait for Network Response
[
{ "waitForResponse": "/api/data" }
]
With method filter:
[
{ "waitForResponse": ["/api/data", { "method": "POST" }] }
]
Control Flow
Loop (Repeat N Times)
[
{
"loop": {
"repeat": 3,
"do": [
{ "click": ".load-more" },
{ "wait": 1000 }
]
}
}
]
Loop (Over Elements)
[
{
"loop": {
"each": ".product-card",
"do": [
{ "getText": "$this .title" },
{ "getText": "$this .price" }
]
}
}
]
If / Else
[
{
"if": {
"condition": "#cookie-banner",
"then": [{ "click": "#accept-cookies" }]
}
}
]
With comparison:
[
{
"if": {
"condition": {
"selector": ".price",
"property": "textContent",
"operator": "contains",
"value": "$0.00"
},
"then": [{ "click": ".add-to-cart" }],
"else": [{ "click": ".wishlist" }]
}
}
]
Data Caching
Save data for later use:
[
{ "getText": ["h1", { "save": "title" }] },
{ "fill": ["input[name='search']", "${title}"] }
]
Working with Iframes
Target elements inside an iframe:
[
{ "click": ["#btn-inside-iframe", { "iframe": "#my-iframe" }] }
]
Nested iframes:
[
{ "click": ["#btn", { "iframe": ["#outer-iframe", "#inner-iframe"] }] }
]
Full Example
Login, extract data, and take a screenshot:
[
{ "open": "https://example.com/login" },
{ "fill": ["input[name='email']", "user@example.com"] },
{ "fill": ["input[name='password']", "secret123"] },
{ "click": "#login-btn" },
{ "waitForElement": ".dashboard" },
{ "getText": [".welcome-message", { "save": "greeting" }] },
{ "screenshot": "fullpage" }
]
Google search and extract results:
[
{ "open": "https://www.google.com" },
{ "fill": ["textarea[name='q']", "BrowserWorker automation"] },
{ "press": "Enter" },
{ "waitForElement": "#search" },
{ "extractAll": ["#search h3", "text"] },
{ "screenshot": true }
]