DocumentationAPI DetailsScrape URLBrowser Commands

Browser Commands

Browser commands let you interact with a web page before extracting its content. Use them to click buttons, fill forms, select dropdown options, scroll to load dynamic content, wait for elements, or run custom JavaScript. This is essential for scraping pages that require user interaction to reveal data.

All commands execute with human-like behavior - the mouse moves realistically to elements before clicking, typing speed varies naturally, and random pauses occur between actions. This significantly reduces the chance of bot detection.

Any errors encountered during command execution are returned in the errorMessages response field.

When To Use This

  • Cookie consent banners - Click “Accept Cookies” before scraping page content.
  • “Load More” buttons - Click pagination or infinite scroll triggers to load additional data.
  • Search forms - Enter search queries and submit forms to reach results pages.
  • Multi-step workflows - Navigate through login flows, multi-page wizards, or tabbed interfaces.
  • Lazy-loaded content - Scroll the page to trigger content that loads on viewport entry.
  • Dynamic elements - Wait for AJAX-loaded components to appear before extracting data.

Available Commands

CommandValueExample
click / tapCSS selector of the element to click.{ "click": "#buttonId" }
input / fill / typeCSS selector and value to enter.{ "input": { "input[name='email']": "example@test.com" } }
select / choose / pickCSS selector and option value or text.{ "select": { "select[name='country']": "USA" } }
scrollPixels to scroll down (negative = up).{ "scroll": 1000 }
waitMilliseconds to pause (max 15000).{ "wait": 5000 }
waitfor / wait-for / wait_forCSS selector to wait for.{ "waitfor": "#newForm" }
javascript / js / evalJavaScript code to execute on the page.{ "javascript": "console.log('hello!!')" }

Each command has multiple aliases (e.g., click/tap, input/fill/type) so you can use whichever feels most natural.

Finding CSS Selectors

If you need help identifying the right CSS selectors for page elements, try the Rayrun browser extension. It lets you point at elements on any page and generates the CSS selector for you.

Natural language browser control is coming soon - describe what you want in plain English instead of writing CSS selectors.

Example: Fill and Submit a Form

This example navigates to a test form, fills in fields, selects a dropdown, waits for elements, clears the form, scrolls, and runs custom JavaScript:

Browser commands are only available via POST requests.

POST https://api.scrapi.tech/v1/scrape

{
  "url": "https://www.roboform.com/filling-test-all-fields",
  "useBrowser": true,
  "acceptDialogs": true,
  "browserCommands": [
    { "input": { "input[name='01___title']": "Mr" } },
    { "input": { "input[name='02frstname']": "Werner" } },
    { "input": { "input[name='04lastname']": "van Deventer" } },
    { "select": { "select[name='40cc__type']": "Discover" } },
    { "wait": 3000 },
    { "waitfor": "input[type='reset']" },
    { "click": "input[type='reset']" },
    { "wait": 1000 },
    { "scroll": 500 },
    { "javascript": "console.log('any valid code...')" }
  ]
}

A common pattern for bypassing cookie banners and performing a site search:

{
  "url": "https://example.com",
  "useBrowser": true,
  "browserCommands": [
    { "click": "#accept-cookies" },
    { "wait": 1000 },
    { "input": { "input[name='q']": "web scraping API" } },
    { "click": "button[type='submit']" },
    { "waitfor": ".search-results" },
    { "scroll": 2000 }
  ]
}
  • Real Browser - Browser commands require a real browser (automatically enabled).
  • Captcha Solving - Combine with captcha solving for sites that challenge after interactions.
  • Sessions - Persist state across multiple requests when building multi-step scrapers.
  • Video Recording - Record a video of browser commands executing for debugging and verification.
  • MCP Server - Use browser commands in AI agent workflows via the Model Context Protocol.

Testing

Test this request in the Playground or view the OpenAPI specification.