Skip to main content

ScrapingAPI Browser Instructions

Written by Proxyrack

Render a page in a real browser, tell it what to wait for or do, and get the page plus any captured network response back as JSON.
​

Endpoint

POST https://scrape.proxyrack.net/api/v1-beta/?api_key=YOUR_KEY Content-Type: application/json

The API key goes in the query string, everything else in the JSON body. The existing GET /api/v1/ endpoint is unchanged.
​

Request

{   "url": "https://example.com/page",   "country_code": "us",   "device_type": "desktop",   "premium": true,   "referer": "https://www.google.com/",    "render": {     "instructions": [ ... ]   } }

Send render to load the page in a browser, or http for a plain request. One or the other, not both.

Field

Meaning

country_code

Optional exit country, ISO 3166-1 alpha-2, lowercase.

device_type

desktop (default) or mobile.

premium

Default true.

referer

Sent as the navigation referrer.

render.instructions

Steps the browser runs after the page has loaded, in order. "render": {} renders with no steps.

http.method, http.body

Plain mode only: request method and body, for form or JSON posts.

Instructions

Every step is {"type": ..., ...}. Times are seconds, fractions allowed. Each wait needs a timeout; the whole plan must fit in 60 seconds.

Type

Fields

Does

wait

seconds

Pause.

wait_for_selector

selector, state, timeout

Wait until an element matching selector is attached (default), visible, or hidden.

wait_for_response

url_contains, method, timeout, capture

Wait for an XHR or fetch whose URL contains the text. With capture: true its status, headers and body are returned in the step result.

wait_for_navigation

timeout

Wait for the page to navigate to a new document, e.g. after a click.

wait_for_load

state, timeout

Wait until the current document reaches load (default), domcontentloaded or networkidle.

click

selector

Scroll the element into view and click it.

input

selector, value

Focus the element and type the value.

evaluate

script, timeout

Run JavaScript in the page; the value you return comes back as the step result. Async and await work.

Selectors are one of {"css": "#id"}, {"xpath": "//div[@id='id']"}, or {"text": "Track shipment"} (substring of the rendered text).

may_fail: true on any step lets the plan continue if that step fails; the error is still reported on the step.

Response

{   "status_code": 200,   "resolved_url": "https://example.com/page",   "headers": [{"name": "content-type", "value": "text/html"}, ...],   "body": "<html>...",   "render": {     "steps": [       {"type": "wait_for_response", "duration": 4.7,        "result": {"url": "...", "status_code": 200, "headers": [...], "body": "{...}"}}     ],     "xhr": [{"url": "...", "method": "POST", "status_code": 200, "size": 4381}, ...]   } }
  • status_code, resolved_url, headers and body describe the final document, after redirects and navigations. body is the rendered DOM.

  • steps has one entry per instruction that ran, in order, with its duration and, for wait_for_response with capture and for evaluate, a result.

  • xhr lists every XHR and fetch the page made, so you can find the data call to capture.

Example: MSC container tracking

The page loads its result through a TrackingInfo request after load. Capture that instead of parsing the DOM:

curl -s 'https://scrape.proxyrack.net/api/v1-beta/?api_key=YOUR_KEY' \   -H 'Content-Type: application/json' \   -d '{     "url": "https://www.msc.com/en/track-a-shipment?params=dHJhY2tpbmdOdW1iZXI9RUJLRzE4MDM5MjgyJnRyYWNraW5nTW9kZT0x",     "premium": true,     "render": {       "instructions": [         {"type": "wait_for_response", "url_contains": "TrackingInfo", "timeout": 40, "capture": true}       ]     }   }'

The carrier’s JSON is in render.steps[0].result.body. Typical time: about 10 seconds. params is base64 of trackingNumber=EBKG18039282&trackingMode=1; both keys must be present or the page does not search.

Notes

  • One render is one browser on one exit IP; the page and its XHRs share both.

  • Custom request headers and cookies are not accepted in this beta; referer is the one request header you can set.

  • Unknown fields, unknown instruction types and legacy instruction shapes are rejected with 400 naming the field.

Did this answer your question?