Skip to main content

Wait (Delay)

Add time-based delays to your scraping workflow to allow pages to load or simulate human behavior.

Basic Wait

Add a simple delay before extracting content:
{
  "url": "https://example.com",
  "actions": [
    {
      "type": "wait",
      "duration": 3000
    }
  ]
}

Parameters

ParameterTypeRequiredDescription
typestringYesMust be "wait"
durationintegerYesWait time in milliseconds

Use Cases

Page Load Delays

Wait for slow-loading pages:
{
  "url": "https://slow-loading-site.com",
  "actions": [
    {
      "type": "wait", 
      "duration": 5000
    }
  ]
}

Human-like Behavior

Simulate natural browsing patterns:
{
  "url": "https://social-media-site.com",
  "actions": [
    {
      "type": "click",
      "selector": "button.load-more"
    },
    {
      "type": "wait",
      "duration": 2000
    },
    {
      "type": "scroll",
      "direction": "down"
    }
  ]
}

Rate Limiting

Add delays between actions to avoid rate limits:
{
  "url": "https://api-heavy-site.com", 
  "actions": [
    {
      "type": "click",
      "selector": ".next-page"
    },
    {
      "type": "wait",
      "duration": 1000
    },
    {
      "type": "click", 
      "selector": ".load-data"
    }
  ]
}

Best Practices

Optimal Wait Times

  • Short delays (500-1000ms) - For fast-loading elements
  • Medium delays (2000-5000ms) - For complex page loads
  • Long delays (5000ms+) - For very slow or heavy pages

Performance Considerations

  • Use sparingly - Unnecessary waits slow down scraping
  • Combine with other wait types - Use wait_for_selector when possible
  • Monitor timeouts - Ensure total request time stays reasonable

Error Handling

{
  "url": "https://example.com",
  "timeout": 30000,
  "actions": [
    {
      "type": "wait",
      "duration": 3000
    }
  ]
}

SDK Examples

Node.js

const result = await client.scrape({
  url: 'https://example.com',
  actions: [
    {
      type: 'wait',
      duration: 3000
    }
  ]
});

Python

result = client.scrape({
    'url': 'https://example.com',
    'actions': [
        {
            'type': 'wait',
            'duration': 3000
        }
    ]
})