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 moreAuto Trait Implementations§
impl Freeze for StealthContextOptions
impl RefUnwindSafe for StealthContextOptions
impl Send for StealthContextOptions
impl Sync for StealthContextOptions
impl Unpin for StealthContextOptions
impl UnsafeUnpin for StealthContextOptions
impl UnwindSafe for StealthContextOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more