Dynamic Content & Timing Issues
When scraping JavaScript-heavy sites, SPAs, or pages with delayed content loading, timing becomes critical.Multiple Wait-For Selectors
Thewait_for
parameter handles dynamic content, but edge cases like empty results require careful selector planning:
Testing CSS Selectors Before Scraping
Before using CSS selectors in your scraping code, test them directly in the browser console:- Open the target page in your browser
- Open Developer Tools (F12 or ⌘+⌥+I)
- In the Console tab, test your selector:
- Verify it returns the expected elements across different page states
Anti-Bot Protection & Access Issues
When sites block your requests or return unexpected errors, these debugging techniques help identify the root cause.Error 422: Unprocessable Entity
This typically means anti-bot protection is blocking access. Solutions include:- Enable JavaScript rendering:
js_render: true
to mimic real browser behavior - Use premium proxies: Set
premium_proxy: true
to route traffic through residential IPs - Add a referer header: Include
referer: 'https://www.google.com/'
to mimic typical browser behavior - Wait for content to load: Use
wait_for
orwait
parameters for slower sites
If your success rate suddenly drops, it’s often due to new anti-bot challenges or region-specific blocks. Enabling
js_render
, switching proxy regions, or using premium_proxy: true
typically resolves this.Retrieving Original Status Codes
When a target website returns an error, ZenRows handles it gracefully by default. Useoriginal_status
to see what’s actually happening:
403
Forbidden or 429
Too Many Requests.
Allowing Specific Status Codes
Examine error pages or handle specific status codes by allowing them to pass as successful responses:Region-Restricted Sites
Geographic restrictions require specific approaches to access localized content.Error 422 with Geo-Restrictions
When content is region-locked, adjust your geographic approach:- Specify target country: Use
proxy_country: 'us'
or another accessible region - Enable premium proxies: Set
premium_proxy: true
for residential IPs - Test different regions: Some content may be available in multiple countries
Performance & Resource Management
Optimize your scraping efficiency and manage API limits effectively.Error 429: Too Many Requests
This indicates you’ve reached your concurrency limit. Solutions include:- Request queue implementation: Space out requests using a queue
- Concurrency monitoring: Check the
concurrency-remaining
response header - Backoff strategy: Increase delays when 429 errors occur
- Complete requests fully: Don’t cancel requests - let them finish to release concurrency slots
If you begin to notice a lower-than-usual success rate, monitor your concurrency usage and ensure requests are being spaced out appropriately. Sudden spikes can trigger errors due to the concurrency limit being reached.
Error 413: Content Too Large
When responses exceed your plan’s size limits:- Use CSS selectors: Extract only needed data with
css_extractor
- Disable JSON response: Remove
json_response
if not needed to reduce payload size - Implement pagination: Split large data sets into multiple requests
Session-Dependent Sites
For multi-step workflows requiring consistent session state.Session management issues
When session state needs to persist across multiple requests:- Use consistent session IDs: Apply the same
session_id
across related requests - Maintain custom headers: Include necessary cookies and authentication headers
- Test session flow: Verify each step maintains the required state
Getting Support
If you’re still encountering issues after applying these targeted solutions, ZenRows’ support team is ready to help. Prepare Request Details:- Target URL and all parameters used
- Request ID from the
X-Request-Id
response header - Expected vs. actual results