Skip to main content
DynamicFetcher provides full browser automation capabilities using Playwright. It’s ideal for scraping JavaScript-heavy single-page applications (SPAs) and sites requiring complex user interactions.

Basic Usage

One-Off Requests

With DynamicSession

For multiple requests, use DynamicSession to keep the browser open:

Key Features

JavaScript Execution

Network Idle

Wait for all network requests to complete:

Custom Page Actions

Execute custom automation before returning the response:

Request Parameters

DynamicFetcher.fetch()

Advanced Features

Wait for Selectors

Wait for specific elements before returning:
Selector states:
  • attached: Element exists in DOM
  • visible: Element is visible on page
  • hidden: Element exists but is hidden

Resource Blocking

Block unnecessary resources for faster loading:
Blocked resource types when disable_resources=True:
  • font, image, media
  • beacon, object, imageset
  • texttrack, websocket
  • csp_report, stylesheet

Initialization Scripts

Run JavaScript on every page creation:

Real Chrome vs Chromium

Use your installed Chrome browser:
Requires Chrome to be installed on your system.

CDP Connection

Connect to an existing browser instance:

Custom Headers and Referer

Session Management

Basic Session

Async Session with Page Pool

Per-Request Proxy Override

Practical Examples

Infinite Scroll

Form Submission

Load More Button

Screenshot Capture

Error Handling

Best Practices

Always use DynamicSession when making multiple requests. This keeps the browser open and maintains cookies.
Enable disable_resources=True to block images, fonts, and stylesheets for faster page loads.
Complex SPAs may need longer timeouts. Set timeout=60000 or higher for slow-loading pages.
Only use network_idle=True when necessary - it adds extra wait time. For most cases, load_dom=True is sufficient.
Use page_action instead of making multiple fetch calls for interactions on the same page.
Use max_pages to control concurrent tab usage in async sessions. Default is 1.

Comparison with Other Fetchers

Next Steps

Stealthy Mode

Learn about StealthyFetcher for anti-bot bypass

Sessions

Master session management

Proxy Rotation

Rotate proxies automatically