WebScrapingAPI Docs
HomeLoginRegister
  • Introduction
    • Registration
    • Pricing
    • Free APIs
    • API Errors
    • Custom Response Headers
  • Browser API
    • Getting Started
      • Access the API
      • Authentication
      • API Parameters
    • Basic API Requests
      • GET Request
      • POST, PUT & PATCH Requests
      • Proxy Mode
    • Advanced API Features
      • Awaiting
      • Geolocation
      • Sessions
      • Forcing Timeouts
      • Custom Headers
      • Custom Cookies
      • Device Type
      • Viewport Sizing
      • Screenshot
      • Screenshot Options
      • Extraction Rules
      • JavaScript Instructions
      • Full JSON Response
      • JSON DOM Response
      • Block Resources
      • Captcha Solving
  • WebScrapingAPI
    • Getting Started
      • Access the API
      • API Parameters
    • Basic API Requests
      • GET Request
      • POST, PUT & PATCH Requests
    • Advanced API Features
      • Geolocation
      • Extraction Rules
      • Full JSON Response
      • JSON DOM Response
      • Rendering JavaScript
  • WebStealthProxy
    • Getting Started
      • Access the Proxy
      • Usage and Statistics
    • Basic Proxy Requests
    • Advanced Proxy Requests
      • Sessions
      • Geolocation
      • Custom Headers
      • Custom Cookies
      • Screenshots
  • Google Search API
    • Getting Started
      • Access the API
      • API Parameters
    • Google Search Engines
      • Google Search API
      • Google Maps API
      • Google Maps Reviews API
      • Google Reverse Image API
      • Google Trends API
        • Geo Parameter Options List
        • Google Trends Categories List
  • WB CUSTOM SEARCH API
    • Getting Started
      • Access the API
      • API Parameters
    • WB Custom Search Engines
      • Wayfair Product API
      • Best Buy Product API
      • Nordstrom Product API
  • Amazon Search API
    • Getting Started
      • API Parameters
      • Access the API
      • Supported Domains
    • Amazon Search Types
      • Amazon Search
      • Amazon Seller
        • Amazon Seller Products
        • Amazon Seller Profile
        • Amazon Seller Feedback
      • Amazon Product
      • Amazon Category
      • Amazon Bestsellers
      • Amazon New Releases
      • Amazon Deals
  • Bing Search API
    • Getting Started
      • Access the API
      • API Parameters
    • Basic API Requests
Powered by GitBook
On this page
  • The wait_until parameter
  • The wait_for parameter
  • The wait_for_css parameter
  1. Browser API
  2. Advanced API Features

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

Passing 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=$promise
Available options

The currently supported options for the wait_until parameter are:

  • load - load event is fired.

  • domcontentloaded - DOMContentLoaded event is fired.

  • networkidle0 - there are no more than 0 network connections for at least 500 ms.

  • networkidle2 - there are no more than 2 network connections for at least 500 ms.

The wait_for parameter

This 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=$milliseconds

The values passed to the wait_for parameter are expressed in milliseconds. We recommend that you use a value between 5000 and 10000.

The wait_for_css parameter

When 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=$cssSelector

We recommend that the $cssSelector value should be encoded or escaped in order for your request to pass successfully.

PreviousAdvanced API FeaturesNextGeolocation

Last updated 9 months ago