JavaScript rendering
which emulates a real browser environment to fully load and render the page before extracting the data.
This also allows to interact with the page, like clicking on buttons, filling forms, etc.
render=true
with the request. This will open a real browser environment to render the page, allows you to interact with the page, and extract the data that is not available in the initial HTML response.
window_width
parameter specifies the browser’s width in pixels. It must be a positive integer; otherwise, you will receive a validation error. You can set up to a maximum value of 3820 as the window width.
In the following example, we set the window width to 1920 pixels:
window_height
parameter. The value must be a positive integer, and the maximum height is 2680 pixels. If you exceed this limit, you will receive a validation error.
In this example, we set the window height to 1080 pixels:
window_width
and window_height
in a single request
In this example, we set the browser window to 1920x1080:
instructions
query parameters. Each object can have different properties based on the instruction you want to perform. When passing the instructions inside the query parameters make sure to stringify them into a json before sending it ot the API. To do this you can use our Builder to generate the instructions easily
Here is an example of using instructions:
.btn
CSS selector to appear on the page, then click on the first element with the matching .btn2
CSS selector. This accepts an array of command that will execute sequentially. The instructions parameter should be URL encoded before passing it to the API.
Here is an example of using instructions in a request:
wait
instruction pauses the execution until the specified CSS selector is found on the page. This is very useful for handling SPA (Single Page Application) or dynamic content websites.
This ensures that the page is fully loaded before proceeding to the next instruction. For instance, you want to ensure that a message element will be visible after submitting a form, you can use the wait
instruction to wait for the message element to appear. The wait
instruction accepts a CSS selector as a string.
click
instruction simulates a click event on a specified CSS selector. It lets you programmatically click on a button, link, or any other element on the page. This is useful for navigating to another page, submitting a form, or triggering an action.
This instruction often pairs with the wait
instruction to ensure that the element is present before clicking on it. For example, on a search page, you can wait for the search button to appear and then click on it to submit the search query.
delay: 5000
will pause for 5 seconds before proceeding to the next instruction.
This can be useful when you need to wait for a specific time before performing the next action. For example, you can use the delay instruction to wait for a modal to appear after clicking a button.
fill
instruction inputs text into a specified form field. It accepts the following properties:
selector
: The valid input field CSS selector.text
: The value text you want to input in that field.delay
: The number in ms of type speed. This is optional and defaults to 0.fill
instruction to input a search query into a search field.
1. How long does the API wait for a selector to appear when using `wait`?
2. Does JavaScript rendering increase the cost of the request?
3. What is the difference between `wait` and `delay`?
wait
and delay
. wait
pauses execution
until the specified selector appears on the page, while delay
pauses
execution for a specified duration before proceeding to the next instruction.