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: trueto mimic real browser behavior - Use premium proxies: Set
premium_proxy: trueto route traffic through residential IPs - Add a referer header: Set
custom_headers=trueand sendReferer: https://www.google.com/to mimic typical browser behavior - Wait for content to load: Use
wait_fororwaitparameters 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.Still failing after stacking parameters? Retest with the minimal config
Extra parameters change how the request behaves, and on some protected sites they can lower your success rate instead of raising it. Thereferer value is a header, so it needs custom_headers=true.
If you still get 422 after adding wait, wait_for, or a custom referer header on top of js_render=true and premium_proxy=true, follow these steps:
- Remove the extra parameters and retest with only
js_render=trueandpremium_proxy=true. - Add the extras back one at a time, and keep only the ones that help.
- Keep
proxy_countryif the site is region-restricted. See Error 422 with Geo-Restrictions.
X-Request-Id response header so the team can check what the target site is doing.
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: truefor 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-remainingresponse 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_responseif 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_idacross 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-Idresponse header - Expected vs. actual results