pub struct Browser { /* private fields */ }Expand description
High-level interface for working with a Chrome DevTools Protocol browser.
Instances are typically produced via Browser::launcher.
Implementations§
Source§impl Browser
impl Browser
Sourcepub async fn new_context(self: &Arc<Self>) -> Result<Arc<BrowserContext>>
pub async fn new_context(self: &Arc<Self>) -> Result<Arc<BrowserContext>>
Creates a new, isolated browser context using default options. This is equivalent to opening a new incognito window.
§Examples
use cdp_core::Browser;
let browser = Browser::launcher().launch().await?;
let context = browser.new_context().await?;Sourcepub async fn new_context_with_options(
self: &Arc<Self>,
options: BrowserContextOptions,
) -> Result<Arc<BrowserContext>>
pub async fn new_context_with_options( self: &Arc<Self>, options: BrowserContextOptions, ) -> Result<Arc<BrowserContext>>
Creates a new browser context with the provided options.
§Examples
use cdp_core::{Browser, BrowserContextOptions};
let browser = Browser::launcher().launch().await?;
let options = BrowserContextOptions {
dispose_on_detach: Some(true),
..Default::default()
};
let context = browser.new_context_with_options(options).await?;Sourcepub async fn contexts(&self) -> Vec<Arc<BrowserContext>>
pub async fn contexts(&self) -> Vec<Arc<BrowserContext>>
Returns all live browser contexts tracked by this browser.
Sourcepub async fn get_context(&self, id: &str) -> Option<Arc<BrowserContext>>
pub async fn get_context(&self, id: &str) -> Option<Arc<BrowserContext>>
Attempts to fetch an existing browser context by id.
Auto Trait Implementations§
impl Freeze for Browser
impl !RefUnwindSafe for Browser
impl Send for Browser
impl Sync for Browser
impl Unpin for Browser
impl !UnwindSafe for Browser
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
Mutably borrows from an owned value. Read more