apply_stealth_to_page

Function apply_stealth_to_page 

Source
pub async fn apply_stealth_to_page(
    page: &Page,
    config: &BrowserConfig,
) -> Result<()>
Expand description

Inject all stealth scripts into a freshly opened browser page.

Scripts are registered with Page.addScriptToEvaluateOnNewDocument so they execute before any page-owned JavaScript on every subsequent navigation. Which scripts are injected is determined by crate::config::StealthLevel:

LevelInjected content
NoneNothing
BasicCDP leak fix + navigator.webdriver removal + minimal navigator spoof
AdvancedBasic + full WebGL/navigator spoofing + fingerprint + WebRTC protection

§Errors

Returns crate::error::BrowserError::CdpError if a CDP command fails.

§Example

use stygian_browser::stealth::apply_stealth_to_page;
apply_stealth_to_page(page, config).await?;