Awaiting
When scraping the web, you may want to wait for various elements. BrowserAPI offers you the options to wait for almost everything related to the targeted website.
The wait_until parameter
wait_until parameterPassing the wait_until parameter to your request tells the browser that a certain promise is still ongoing, hence preventing the service worker from terminating until the promise is resolved.
Your full GET request should then be sent to the following address:
https://api.webscrapingapi.com/v1?api_key=<YOUR_API_KEY>&url=<TARGETED_URL>&wait_until=$promiseThe wait_for parameter
wait_for parameterThis option comes in handy when dealing with websites that have dynamic-generated content. Passing the wait_for parameter will instruct BrowserAPI to wait for a certain amount of time after the page finished loading and before closing the connection.
Your full GET request should then be sent to the following address:
https://api.webscrapingapi.com/v1?api_key=<YOUR_API_KEY>&url=<TARGETED_URL>&wait_for=$millisecondsThe wait_for_css parameter
wait_for_css parameterWhen you want to scrape a specific element of the page, passing the wait_for_css parameter will make BrowserAPI wait for that specific CSS selector to be available in DOM before returning the result.
Your full GET request should then be sent to the following address:
https://api.webscrapingapi.com/v1?api_key=<YOUR_API_KEY>&url=<TARGETED_URL>&wait_for_css=$cssSelectorWe recommend that the $cssSelector value should be encoded or escaped in order for your request to pass successfully.
Last updated