The Wait parameter introduces a fixed delay during JavaScript rendering, allowing web pages additional time to load dynamic content before ZenRows fully captures the HTML. Many websites load content progressively through JavaScript, AJAX calls, or other asynchronous processes that occur after the initial page has been rendered. When you add the wait parameter to your request, ZenRows pauses for the specified duration (in milliseconds) after the page initially loads, ensuring that slow-loading elements, animations, and dynamically generated content have time to appear before the HTML is extracted. The maximum wait value acceptable is 30 seconds (30,000 milliseconds).
The Wait parameter requires js_render=true to function, as it operates within the browser environment during JavaScript rendering.

How the Wait parameter works

The Wait parameter creates a pause in the scraping process after the initial page load completes. During this waiting period, the headless browser remains active, allowing JavaScript to continue executing, AJAX requests to complete, and dynamic content to render. This process ensures you capture:
  • Content loaded through delayed AJAX calls
  • Elements that appear after animations complete
  • Data populated by slow third-party APIs
  • Progressive loading sequences
  • Time-sensitive dynamic updates
The wait occurs after the initial DOM load but before the final HTML extraction, giving websites the necessary time to complete their loading processes.

Basic usage

Add the wait parameter with a value in milliseconds to your JavaScript rendering request:
# pip install requests
import requests

url = 'https://httpbin.io/anything'
apikey = 'YOUR_ZENROWS_API_KEY'
params = {
    'url': url,
    'apikey': apikey,
    'js_render': 'true',
    'wait': '5000',
}
response = requests.get('https://api.zenrows.com/v1/', params=params)
print(response.text)
This example waits 5 seconds (5000 milliseconds) after the page loads before capturing the HTML content. During this time, any JavaScript-driven content loading processes can complete.

When to use the Wait parameter

The Wait parameter is essential in these scenarios:

Content loading delays:

  • Slow API responses - Pages that fetch data from slow external APIs
  • Progressive content loading - Sites that load content in multiple stages
  • Heavy JavaScript processing - Pages with complex calculations or data processing
  • Third-party widgets - External content like maps, charts, or embedded media
  • Animation sequences - Content that appears after CSS or JavaScript animations

Timing-dependent content:

  • Real-time data - Stock prices, live scores, or updating counters
  • Lazy loading - Images or content that loads as needed
  • Scroll preparation - Initial content that loads before scroll triggers
  • Form validation - Dynamic form elements that appear based on user input simulation

Best practices

Start with reasonable defaults

Begin with moderate wait times and adjust based on results:
Python
def smart_wait_scraping(url, target_indicators):
    """
    Use progressive wait times to find the minimum necessary delay
    """
    wait_times = [2000, 4000, 6000, 8000]  # Progressive wait times
    
    for wait_time in wait_times:
        response = requests.get('https://api.zenrows.com/v1/', params={
            'url': url,
            'apikey': 'YOUR_ZENROWS_API_KEY',
            'js_render': 'true',
            'wait': str(wait_time),
        })
        
        # Check if all target content is present
        content_found = all(indicator in response.text for indicator in target_indicators)
        
        if content_found:
            print(f"Optimal wait time found: {wait_time}ms")
            return response, wait_time
    
    print("Content not found even with maximum wait time")
    return None, None

# Usage
indicators = ['product-price', 'customer-reviews', 'stock-status']
result, optimal_wait = smart_wait_scraping('https://httpbin.io/anything', indicators)

Combine with other parameters for maximum effectiveness

Use Wait with Premium Proxy for protected sites:
Python
params = {
    'url': 'https://httpbin.io/anything',
    'apikey': 'YOUR_ZENROWS_API_KEY',
    'js_render': 'true',
    'premium_proxy': 'true',
    'wait': '6000',
}

Troubleshooting

Common issues and solutions

IssueCauseSolution
Content still missingWait time too shortIncrease wait duration incrementally
Inconsistent resultsVariable loading timesUse longer wait time, use wait_for, or implement retry logic
REQS004Invalid value provided for wait parameter; value is too big (REQS004)Keep wait under 30 seconds total or use wait_for
Unnecessary delaysFixed wait for fast-loading contentUse wait_for parameter for dynamic waiting

Debugging missing content with Wait

When content is still missing despite using the Wait parameter:
1

Check browser behavior manually

  • Compare with manual browser testing
  • Open the page in a browser and time how long content takes to appear
  • Use that timing as your baseline wait duration
2

Increase wait time gradually

Python
# Try progressively longer wait times
for wait_time in [3000, 6000, 9000, 12000]:
    response = requests.get('https://api.zenrows.com/v1/', params={
        'url': url,
        'apikey': 'YOUR_ZENROWS_API_KEY',
        'js_render': 'true',
        'wait': str(wait_time),
    })
    
    if 'expected-content' in response.text:
        print(f"Content found with {wait_time}ms wait")
        break
3

Switch to the element-specific waiting (`wait_for`)

Python
params = {
    'js_render': 'true',
    'wait_for': '.content',   # Wait for specific element
}
See more on Wait_for documentation page

Understanding wait time limits

ZenRows has built-in limits for wait times to ensure service stability:
  • Maximum total wait time: 30 seconds (30,000 milliseconds)
  • Recommended range: 2,000 - 10,000 milliseconds (2-10 seconds)
  • Minimum practical wait: 1,000 milliseconds (1 second). Values below that are acceptable but impractical

Pricing

The wait parameter doesn’t increase the request cost. You pay the JavaScript Render (5 times the standard price) regardless of the wait value you choose.

Frequently Asked Questions (FAQ)