When to Use
Infinite scroll pages (auto-enables Playwright via
INFINITE_SCROLL)An existing spider already pinned to
"playwright" in EXTRACTOR_ORDERFor new JS-rendered or anti-bot sites, prefer
BROWSER_ENABLED / CLOUDFLARE_ENABLED instead — see the warning above.Configuration
Basic Playwright
Wait for Selector
.article-content element (max 30s). Extraction fails if selector doesn’t appear.
Additional Delay
.loaded element, then waits an additional 5 seconds before extraction.
Infinite Scroll
Settings Reference
CSS selector to wait for before extractionTimeout: 30 secondsUse when: Content loads via AJAX/fetchExample:
Additional seconds to wait after page loadUse when: Content appears with unpredictable timingExample:
Enable infinite scroll behaviorNote: Setting this auto-adds
"playwright" to EXTRACTOR_ORDER if not already presentExample:Maximum scroll iterationsExample:
Delay between scrolls (seconds)Example:
Identifying JS-Rendered Sites
Signs page needs Playwright:-
Minimal HTML: View page source shows almost empty body
- Content in script tags: Data exists only as JavaScript objects
- Loading placeholders: “Loading…” text or spinner elements
- Generic extractors fail: Newspaper/trafilatura return no content
"BROWSER_ENABLED": true (or "CLOUDFLARE_ENABLED": true); use Playwright only for infinite scroll or an existing playwright-based spider.
Common Wait Selectors
Performance Optimization
Reduce Concurrency
Use Playwright Only When Needed
Hybrid Strategy
Examples
SPA (React/Vue/Angular)
Delayed Content
Infinite Scroll (Quotes Example)
follow: false to prevent following links during scroll.
Cloudflare + Playwright
Debugging
Check Playwright Logs
Test Wait Selector
Common Issues
Timeout waiting for selector:- Selector doesn’t exist on page
- Selector appears after 30s (use
PLAYWRIGHT_DELAYinstead) - JavaScript error prevents rendering
- Solution: Use generic selector or remove
PLAYWRIGHT_WAIT_SELECTOR
- Increase
PLAYWRIGHT_DELAY - Page requires interaction - use
INFINITE_SCROLLif applicable
Related
- Extractors Overview - Strategy selection
- Trafilatura Extractor - Recommended after Playwright
- Custom Extractors - For structured JS content
- Settings - All Playwright settings