pub struct BrowserSession { /* private fields */ }Expand description
One Chrome process with any number of pages.
Implementations§
Source§impl BrowserSession
impl BrowserSession
pub async fn launch(opts: LaunchOptions) -> Result<Self>
pub fn id(&self) -> &str
Sourcepub fn process_id(&self) -> Option<u32>
pub fn process_id(&self) -> Option<u32>
OS process id of the Chrome child this session owns.
Sourcepub fn pinned_connections(&self) -> Vec<PinnedConnection>
pub fn pinned_connections(&self) -> Vec<PinnedConnection>
Connections the pinning proxy made, with the address it pinned for each.
pub fn is_headless(&self) -> bool
pub fn profile_dir(&self) -> &Path
pub fn download_dir(&self) -> &Path
Sourcepub async fn new_page(&self, url: &str) -> Result<Arc<BrowserPage>>
pub async fn new_page(&self, url: &str) -> Result<Arc<BrowserPage>>
Open a new page (tab), make it current, and navigate to url.
pub fn pages(&self) -> Vec<Arc<BrowserPage>>
pub fn page(&self, id: &str) -> Result<Arc<BrowserPage>>
Sourcepub fn current(&self) -> Result<Arc<BrowserPage>>
pub fn current(&self) -> Result<Arc<BrowserPage>>
The page actions default to.
Sourcepub async fn select_page(&self, id: &str) -> Result<Arc<BrowserPage>>
pub async fn select_page(&self, id: &str) -> Result<Arc<BrowserPage>>
Make id current and bring it to the front.
pub async fn close_page(&self, id: &str) -> Result<()>
Sourcepub fn downloads(&self) -> HashSet<PathBuf>
pub fn downloads(&self) -> HashSet<PathBuf>
Completed files currently in the download directory.
Sourcepub async fn wait_download(
&self,
before: &HashSet<PathBuf>,
timeout: Duration,
) -> Result<PathBuf>
pub async fn wait_download( &self, before: &HashSet<PathBuf>, timeout: Duration, ) -> Result<PathBuf>
Wait for a download not in before to finish (no .crdownload, stable size).
Sourcepub async fn set_permission(
&self,
origin: Option<&str>,
name: &str,
granted: bool,
) -> Result<()>
pub async fn set_permission( &self, origin: Option<&str>, name: &str, granted: bool, ) -> Result<()>
Set a W3C permission (geolocation, notifications, clipboard-read,
midi, …) to granted or denied for origin, or every origin when None.
pub async fn reset_permissions(&self) -> Result<()>
Trait Implementations§
Source§impl Drop for BrowserSession
impl Drop for BrowserSession
Auto Trait Implementations§
impl !Freeze for BrowserSession
impl !RefUnwindSafe for BrowserSession
impl !UnwindSafe for BrowserSession
impl Send for BrowserSession
impl Sync for BrowserSession
impl Unpin for BrowserSession
impl UnsafeUnpin for BrowserSession
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