pub struct StealthContextOptions {
pub color_scheme: String,
pub device_scale_factor: f64,
pub screen_width: u32,
pub screen_height: u32,
pub viewport_width: u32,
pub viewport_height: u32,
pub is_mobile: bool,
pub has_touch: bool,
pub ignore_https_errors: bool,
pub permissions: Vec<String>,
}Expand description
Browser-context options tuned for stealth emulation.
These values are applied when creating a Playwright browser context in stealth mode. They describe a plausible desktop browsing environment to make the automated session harder to distinguish from a real user.
Fields§
§color_scheme: StringPreferred color scheme (e.g. "dark" or "light").
Bot detectors sometimes check whether this matches the OS setting.
device_scale_factor: f64Device pixel ratio to emulate.
A value of 2.0 simulates a Retina/HiDPI display, which is typical for
modern laptops and helps avoid a low-DPR fingerprint.
screen_width: u32Emulated screen width in pixels.
Combined with screen_height, this sets the reported screen.width value
in JavaScript.
screen_height: u32Emulated screen height in pixels.
Combined with screen_width, this sets the reported screen.height value
in JavaScript.
viewport_width: u32Viewport width in pixels. This is the visible content area width and affects CSS media queries and responsive layouts.
viewport_height: u32Viewport height in pixels. This is the visible content area height and affects CSS media queries and responsive layouts.
is_mobile: boolEmulate a mobile device when true.
Sets navigator.userAgentData.mobile and related hints. Should normally
be false for stealth desktop sessions.
has_touch: boolEmulate touch support when true.
Sets navigator.maxTouchPoints and enables touch events. Should normally
be false for stealth desktop sessions.
ignore_https_errors: boolAccept invalid TLS certificates when true.
Useful for scraping internal or staging sites with self-signed certificates.
Defaults to true in stealth mode.
permissions: Vec<String>Browser permissions to grant automatically.
Pre-granting permissions like "geolocation" and "notifications" prevents
permission prompt dialogs that could stall automation.
Trait Implementations§
Source§impl Clone for StealthContextOptions
impl Clone for StealthContextOptions
Source§fn clone(&self) -> StealthContextOptions
fn clone(&self) -> StealthContextOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more