pub struct Browser { /* private fields */ }Expand description
The main stealth browser
Implementations§
Source§impl Browser
impl Browser
Sourcepub async fn launch() -> Result<Browser, Error>
pub async fn launch() -> Result<Browser, Error>
Launch a new stealth browser with default config
Sourcepub async fn launch_with_config(config: StealthConfig) -> Result<Browser, Error>
pub async fn launch_with_config(config: StealthConfig) -> Result<Browser, Error>
Launch with custom config
Sourcepub async fn connect(ws_url: &str) -> Result<Browser, Error>
pub async fn connect(ws_url: &str) -> Result<Browser, Error>
Connect to an existing Chrome instance at the given WebSocket CDP URL.
Obtain the URL from curl http://localhost:9222/json/version.
Does not patch the binary or manage the Chrome process.
Evasion scripts are still injected into new pages.
Uses default StealthConfig — use connect_with_config() to customize.
Sourcepub async fn connect_with_config(
ws_url: &str,
config: StealthConfig,
) -> Result<Browser, Error>
pub async fn connect_with_config( ws_url: &str, config: StealthConfig, ) -> Result<Browser, Error>
Connect to an existing Chrome instance with a custom config. Allows customizing CDP timeout, evasion scripts, proxy auth, etc.
Sourcepub async fn new_page(&self, url: &str) -> Result<Page, Error>
pub async fn new_page(&self, url: &str) -> Result<Page, Error>
Create a new page and navigate to URL
Sourcepub async fn new_blank_page(&self) -> Result<Page, Error>
pub async fn new_blank_page(&self) -> Result<Page, Error>
Create a new page without navigation (at about:blank)
Sourcepub async fn attach_page(&self, target_id: &str) -> Result<Page, Error>
pub async fn attach_page(&self, target_id: &str) -> Result<Page, Error>
Attach to an existing browser target (e.g., a popup opened by window.open()).
Use tabs() to discover popup target IDs, then call this to get a Page handle.
Sourcepub async fn activate_tab(&self, target_id: &str) -> Result<(), Error>
pub async fn activate_tab(&self, target_id: &str) -> Result<(), Error>
Activate (focus) a tab by target ID