JavaScript Web Scraping API
Many pages only reveal the data you need after a browser has done something: a button has been clicked, a list has been scrolled, a field has been filled, or a small script has run.
A JavaScript-scenario scraping API lets you describe that sequence in a compact instruction list and then receive the resulting page. This page explains the capabilities, shows the shape of a scenario, and gives you a checklist for choosing a plan tier and avoiding common failures.
What a JavaScript scenario is for
A JavaScript scenario is a sequence of browser instructions that runs before the page is captured. It is useful when the content you want is not present in the initial HTML and only appears after user-like interaction. Typical triggers include a 'load more' button, an infinite-scroll list, a search field that filters results, or a widget that needs a moment to render. If the target data is already in the raw response, a plain fetch is simpler and cheaper; reach for a scenario when the page needs action or time.
The five building blocks
The supplied capability set covers five instruction types. Each one maps to a step you would otherwise perform by hand in a browser.
- Mouse click — target a specific element and fire a click, letting you chain several interactions in a fixed order.
- Wait for CSS/XPath elements — pause the run until a selector matches, giving slow content a chance to appear before the next instruction.
- Scrolling — shift the viewport along the page so lazy-loaded blocks or off-screen content come into view.
- Input filling — type values into form fields, which lets you drive search boxes, filters, and similar controls.
- Custom JavaScript execution — inject your own snippet into the page, where it can reach the browser APIs available in that context.
A practical scenario usually combines two or three of these: wait for a button, click it, wait again, scroll, then fill a field or evaluate a small script.
Shape of a scenario
A scenario is passed as a list of instructions. The supplied Python example shows the pattern: wait for a slow button, click it, scroll horizontally twice with short waits between, fill an input, and evaluate a console log. The instruction names are the contract — wait_for, click, scroll_x, wait, fill, and evaluate — and the order matters. The full code sample is provided as a protected module and should be used exactly as supplied rather than retyped from memory.
Decision checklist: do you need a scenario?
Use this checklist before you write a scenario.
- Is the target data present in the initial HTML response? If yes, skip the scenario.
- Does the page require a click, scroll, or form fill before the data appears? If yes, a scenario is appropriate.
- Can you identify a stable CSS or XPath selector for the element you need to wait for? If not, fix the selector first.
- Is the sequence short and deterministic? Long, branching sequences are harder to debug and cost more credits.
- Have you confirmed the plan tier supports the concurrency and credit volume your sequence will consume?
Worked example from the supplied snippet
The supplied Python snippet builds a scenario with six instructions: wait for #slow_button, click it, scroll 1000 pixels, wait one second, scroll another 1000 pixels, wait one second, fill input_1 with value_1, and evaluate console.log('hello'). Read it as a template: the first wait ensures the button exists, the click triggers the content, the two scroll-and-wait pairs give the page time to render, and the fill and evaluate steps demonstrate the remaining instruction types. Adapt the selectors and values to your target page, but keep the ordering logic.
Failure distinctions to plan for
Three failure modes look similar but need different fixes. A wait timeout means the selector never appeared within the allowed window — check the selector and whether the page needs an earlier click. A selector not found means the element exists in the DOM but your CSS or XPath does not match — inspect the live page after the scenario steps run. A credit exhaustion means the sequence ran but consumed more credits than expected — review the credit cost of JavaScript rendering and premium proxies before scaling up. Separating these three early saves debugging time.
Plan fields that affect scenario cost
The pricing table exposes several fields that matter for scenario planning: API credits, concurrent requests, JavaScript rendering, rotating and premium proxies, geotargeting, screenshots and extraction rules, dedicated scraping APIs, priority email support, dedicated account manager, and team management. JavaScript rendering is included on every listed plan, but the credit cost per request varies with rendering and proxy choices. Use the plan table to compare credit volume and concurrency against your expected scenario length and request rate.
Developer resources
The documentation covers the scenario instruction set and includes code samples across languages. A knowledge base collects frequent use cases with examples. Support availability is set by the owner: [support commitment to be confirmed]. Start with the documentation link for the exact instruction names and parameter shapes, then adapt the supplied Python sample to your language of choice.
| Plan | Price | API credits | Concurrent requests | JavaScript rendering | Priority email support | Dedicated account manager | Team management |
|---|---|---|---|---|---|---|---|
| Hobby | $19 /mo | 75,000 | 25 | Included | Not included | Not included | Not included |
| Freelance | $49 /mo | 250,000 | 50 | Included | Not included | Not included | Not included |
| Startup (Recommended) | $99 /mo | 1,000,000 | 100 | Included | Not included | Not included | Not included |
| Business | $249 /mo | 3,000,000 | 200 | Included | Included | Included | Included |
| Business + | $599 /mo | 8,000,000 | 400 | Included | Included | Included | Included |
| Enterprise 14 | $999 /mo | 14,000,000 | 500 | Included | Included | Included | Included |
| Enterprise 24 | $1,599 /mo | 24,000,000 | 600 | Included | Included | Included | Included |
| Enterprise 41 (Recommended) | $2,399 /mo | 41,000,000 | 700 | Included | Included | Included | Included |
| Enterprise 69 | $3,599 /mo | 69,000,000 | 800 | Included | Included | Included | Included |
| Enterprise 120 | $5,799 /mo | 120,000,000 | 900 | Included | Included | Included | Included |
Captured reference from the source page. Prices exclude VAT. Credit validity and rollover: [credit validity and rollover policy to be confirmed]. Per-request credit cost: [per-request credit cost to be confirmed]. JavaScript rendering cost: [rendering credit cost to be confirmed]. Premium proxy cost: [premium proxy credit cost to be confirmed]. Cancellation terms: [cancellation terms to be confirmed]. Confirm current pricing and terms with the owner before purchase.
Frequently asked questions
What does a JavaScript scenario do that a plain request cannot?
A plain request returns the initial HTML. A scenario runs a sequence of browser instructions — waiting for elements, clicking, scrolling, filling inputs, or evaluating custom JavaScript — before the page is captured, so content that only appears after interaction is included.
Which instruction types are available?
The supplied capability set includes mouse click, wait for CSS/XPath elements, scrolling, input filling, and custom JavaScript execution. The Python sample shows the names wait_for, click, scroll_x, wait, fill, and evaluate.
How much does a scenario cost in credits?
Credit cost is set by the owner: [per-request credit cost to be confirmed]. JavaScript rendering cost: [rendering credit cost to be confirmed]. Premium proxy cost: [premium proxy credit cost to be confirmed]. Credit validity and rollover: [credit validity and rollover policy to be confirmed].
What is the difference between a wait timeout and a selector not found?
A wait timeout means the selector never appeared within the allowed window — check the selector and whether an earlier click is needed. A selector not found means the element exists but your CSS or XPath does not match — inspect the live page after the scenario steps run.
Where can I find the exact instruction reference?
The documentation covers the scenario instruction set and includes code samples. A knowledge base collects frequent use cases with examples. Support availability is set by the owner: [support commitment to be confirmed].