Skip to main content

Module config

Module config 

Source
Expand description

Configuration types for browser automation sessions.

This module contains every knob you can turn when launching a browser through scrapling-browser. The primary entry point is BrowserConfig, which controls how the browser is launched, how pages are navigated, and what requests are blocked. For anti-detection scenarios, StealthConfig wraps a BrowserConfig and adds stealth-specific options such as canvas noise and WebRTC blocking.

Most fields on BrowserConfig have sensible defaults (see the Default impl), so you typically only override the two or three settings you care about:

use scrapling_browser::BrowserConfig;

let config = BrowserConfig {
    headless: true,
    disable_resources: true,
    block_ads: true,
    ..Default::default()
};

When you need to tweak behaviour on a per-request basis without rebuilding the entire config, create a FetchParams with only the fields you want to override. The session’s fetch method merges those overrides with the base config into a ResolvedFetchParams struct that carries the final, concrete values used for that single navigation.

§Key types

TypePurpose
BrowserConfigSession-level browser settings (headless, proxy, timeouts, etc.)
StealthConfigAnti-detection wrapper around BrowserConfig
FetchParamsOptional per-request overrides
ResolvedFetchParamsFully resolved values after merging FetchParams + BrowserConfig
ProxyConfigStatic proxy server credentials
CookieParamA cookie to inject before navigation
WaitStateRequired DOM state of a wait selector
PageCallbackAsync closure invoked on a page at setup or post-navigation
StealthContextOptionsViewport / device emulation values for stealth mode

Structs§

BrowserConfig
Browser session configuration – the central struct that controls how the Playwright browser is launched and how pages are navigated.
CookieParam
A cookie to inject into the browser context before navigation.
FetchParams
Per-fetch parameter overrides – a subset of BrowserConfig that can be changed on a per-request basis.
ProxyConfig
Static proxy server connection parameters.
ResolvedFetchParams
Fully resolved fetch parameters produced by merging FetchParams with BrowserConfig.
StealthConfig
Stealth browser configuration – extends BrowserConfig with anti-detection options.
StealthContextOptions
Browser-context options tuned for stealth emulation.

Enums§

WaitState
Required DOM state of a selector before the wait is satisfied.

Type Aliases§

PageCallback
Async callback that receives a Playwright page reference.