Struct chromiumoxide::browser::Browser
source · [−]pub struct Browser { /* private fields */ }
Expand description
A Browser
is created when chromiumoxide connects to a Chromium instance.
Implementations
sourceimpl Browser
impl Browser
sourcepub async fn connect(debug_ws_url: impl Into<String>) -> Result<(Self, Handler)>
pub async fn connect(debug_ws_url: impl Into<String>) -> Result<(Self, Handler)>
Connect to an already running chromium instance via websocket
sourcepub async fn launch(config: BrowserConfig) -> Result<(Self, Handler)>
pub async fn launch(config: BrowserConfig) -> Result<(Self, Handler)>
Launches a new instance of chromium
in the background and attaches to
its debug web socket.
This fails when no chromium executable could be detected.
This fails if no web socket url could be detected from the child processes stderr for more than 20 seconds.
sourcepub async fn start_incognito_context(&mut self) -> Result<&mut Self>
pub async fn start_incognito_context(&mut self) -> Result<&mut Self>
If not launched as incognito this creates a new incognito browser context. After that this browser exists within the incognito session. New pages created while being in incognito mode will also run in the incognito context. Incognito contexts won’t share cookies/cache with other browser contexts.
sourcepub async fn quit_incognito_context(&mut self) -> Result<&mut Self>
pub async fn quit_incognito_context(&mut self) -> Result<&mut Self>
If a incognito session was created with
Browser::start_incognito_context
this disposes this context.
Note This will also dispose all pages that were running within the
incognito context.
sourcepub fn websocket_address(&self) -> &String
pub fn websocket_address(&self) -> &String
Returns the address of the websocket this browser is attached to
sourcepub fn is_incognito(&self) -> bool
pub fn is_incognito(&self) -> bool
Whether the BrowserContext is incognito.
sourcepub fn config(&self) -> Option<&BrowserConfig>
pub fn config(&self) -> Option<&BrowserConfig>
The config of the spawned chromium instance if any.
sourcepub async fn new_page(
&self,
params: impl Into<CreateTargetParams>
) -> Result<Page>
pub async fn new_page(
&self,
params: impl Into<CreateTargetParams>
) -> Result<Page>
Create a new browser page
sourcepub async fn version(&self) -> Result<GetVersionReturns>
pub async fn version(&self) -> Result<GetVersionReturns>
Version information about the browser
sourcepub async fn user_agent(&self) -> Result<String>
pub async fn user_agent(&self) -> Result<String>
Returns the user agent of the browser
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Browser
impl Send for Browser
impl Sync for Browser
impl Unpin for Browser
impl !UnwindSafe for Browser
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more