Expand description
High-level browser session types that drive page fetching.
This is the main module most users interact with. It provides two session types:
-
DynamicSession– a standard browser automation session. It launches (or connects to) a Chromium instance, navigates to URLs, waits for the page to stabilise, and returns ascrapling_fetch::Responsecontaining the rendered HTML, status code, headers, and cookies. Use this for sites that render content with JavaScript but do not actively block bots. -
StealthySession– an anti-detection session that wrapsDynamicSessionbehaviour with stealth Chromium flags, optional WebRTC/canvas/WebGL countermeasures, and an automatic Cloudflare Turnstile solver. Use this for sites protected by Cloudflare, DataDome, or similar services.
§Lifecycle
Both sessions follow the same three-step lifecycle:
- Construct –
::new(config)validates the configuration. - Start –
.start().awaitlaunches the browser and creates a context. - Fetch –
.fetch(url, params).awaitnavigates and returns a response. You can callfetchmultiple times on the same session. - Close –
.close().awaittears down the browser and driver.
Each fetch call automatically retries up to config.retries times with a
configurable delay between attempts.
Structs§
- Dynamic
Session - Standard Playwright browser automation session without stealth measures.
- Stealthy
Session - Anti-detection browser automation session with optional Cloudflare challenge solving.