pub struct BrowserSession { /* private fields */ }Expand description
Browser session that manages a Chrome/Chromium instance
Implementations§
Source§impl BrowserSession
impl BrowserSession
Sourcepub fn launch(options: LaunchOptions) -> Result<Self>
pub fn launch(options: LaunchOptions) -> Result<Self>
Launch a new browser instance with the given options
Sourcepub fn connect(options: ConnectionOptions) -> Result<Self>
pub fn connect(options: ConnectionOptions) -> Result<Self>
Connect to an existing browser instance via WebSocket
Sourcepub fn switch_tab(&mut self, index: usize) -> Result<()>
pub fn switch_tab(&mut self, index: usize) -> Result<()>
Switch to a specific tab by index
Sourcepub fn close_active_tab(&mut self) -> Result<()>
pub fn close_active_tab(&mut self) -> Result<()>
Close the active tab
Navigate to a URL using the active tab
Wait for navigation to complete
Sourcepub fn extract_dom(&self) -> Result<DomTree>
pub fn extract_dom(&self) -> Result<DomTree>
Extract the DOM tree from the active tab
Sourcepub fn extract_simplified_dom(&self) -> Result<DomTree>
pub fn extract_simplified_dom(&self) -> Result<DomTree>
Extract and simplify the DOM tree from the active tab
Sourcepub fn find_element<'a>(&'a self, css_selector: &str) -> Result<Element<'a>>
pub fn find_element<'a>(&'a self, css_selector: &str) -> Result<Element<'a>>
Get element selector by index from the last extracted DOM Note: You need to extract the DOM first using extract_dom()
Sourcepub fn tool_registry(&self) -> &ToolRegistry
pub fn tool_registry(&self) -> &ToolRegistry
Get the tool registry
Sourcepub fn tool_registry_mut(&mut self) -> &mut ToolRegistry
pub fn tool_registry_mut(&mut self) -> &mut ToolRegistry
Get mutable tool registry
Sourcepub fn execute_tool(&self, name: &str, params: Value) -> Result<ToolResult>
pub fn execute_tool(&self, name: &str, params: Value) -> Result<ToolResult>
Execute a tool by name
Sourcepub fn go_forward(&self) -> Result<()>
pub fn go_forward(&self) -> Result<()>
Navigate forward in browser history
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BrowserSession
impl !RefUnwindSafe for BrowserSession
impl Send for BrowserSession
impl Sync for BrowserSession
impl Unpin for BrowserSession
impl !UnwindSafe 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