pub struct BrowserClient { /* private fields */ }Expand description
Browser client for high-level operations
Implementations§
Source§impl BrowserClient
impl BrowserClient
Sourcepub fn new(executor: Arc<dyn BrowserExecutor>) -> Self
pub fn new(executor: Arc<dyn BrowserExecutor>) -> Self
Create a new browser client with the given executor
Sourcepub fn with_default_config() -> Self
pub fn with_default_config() -> Self
Create a client with default configuration
Sourcepub fn executor(&self) -> &Arc<dyn BrowserExecutor>
pub fn executor(&self) -> &Arc<dyn BrowserExecutor>
Get reference to executor (for extension traits)
Sourcepub async fn close(&self) -> Result<(), BrowserError>
pub async fn close(&self) -> Result<(), BrowserError>
Close the browser
Sourcepub fn is_daemon_running(&self) -> bool
pub fn is_daemon_running(&self) -> bool
Check if browser daemon is running
Trait Implementations§
Source§impl InteractionExt for BrowserClient
impl InteractionExt for BrowserClient
Source§async fn click(&self, selector: &str) -> Result<(), BrowserError>
async fn click(&self, selector: &str) -> Result<(), BrowserError>
Click an element by selector
Source§async fn fill(&self, selector: &str, text: &str) -> Result<(), BrowserError>
async fn fill(&self, selector: &str, text: &str) -> Result<(), BrowserError>
Fill a form field with text
Source§async fn type_text(
&self,
selector: &str,
text: &str,
) -> Result<(), BrowserError>
async fn type_text( &self, selector: &str, text: &str, ) -> Result<(), BrowserError>
Type text into an element (character by character)
Source§async fn select_option(
&self,
selector: &str,
value: &str,
) -> Result<(), BrowserError>
async fn select_option( &self, selector: &str, value: &str, ) -> Result<(), BrowserError>
Select an option in a dropdown
Source§async fn scrollintoview(&self, selector: &str) -> Result<(), BrowserError>
async fn scrollintoview(&self, selector: &str) -> Result<(), BrowserError>
Scroll an element into view
Source§async fn drag(&self, source: &str, target: &str) -> Result<(), BrowserError>
async fn drag(&self, source: &str, target: &str) -> Result<(), BrowserError>
Drag and drop from source to destination
Source§impl QueryExt for BrowserClient
impl QueryExt for BrowserClient
Source§async fn snapshot(&self) -> Result<SnapshotResult, BrowserError>
async fn snapshot(&self) -> Result<SnapshotResult, BrowserError>
Take an accessibility snapshot of the current page
Source§async fn screenshot(&self, path: &str) -> Result<(), BrowserError>
async fn screenshot(&self, path: &str) -> Result<(), BrowserError>
Take a screenshot and save to path
Source§async fn eval(&self, script: &str) -> Result<JsonValue, BrowserError>
async fn eval(&self, script: &str) -> Result<JsonValue, BrowserError>
Evaluate JavaScript in the browser
Source§async fn get(&self, what: &str) -> Result<String, BrowserError>
async fn get(&self, what: &str) -> Result<String, BrowserError>
Get page content (text, html, value, url, or title)
Source§async fn get_attr(
&self,
selector: &str,
attr: &str,
) -> Result<String, BrowserError>
async fn get_attr( &self, selector: &str, attr: &str, ) -> Result<String, BrowserError>
Get element attribute value
Source§async fn get_count(&self, selector: &str) -> Result<usize, BrowserError>
async fn get_count(&self, selector: &str) -> Result<usize, BrowserError>
Get count of elements matching selector
Source§async fn get_box(&self, selector: &str) -> Result<BoundingBox, BrowserError>
async fn get_box(&self, selector: &str) -> Result<BoundingBox, BrowserError>
Get element bounding box
Source§async fn get_styles(
&self,
selector: &str,
) -> Result<HashMap<String, String>, BrowserError>
async fn get_styles( &self, selector: &str, ) -> Result<HashMap<String, String>, BrowserError>
Get element computed styles
Source§async fn find(
&self,
locator_type: &str,
value: &str,
action: &str,
action_value: Option<&str>,
) -> Result<String, BrowserError>
async fn find( &self, locator_type: &str, value: &str, action: &str, action_value: Option<&str>, ) -> Result<String, BrowserError>
Find elements using various locator strategies
Source§impl StorageExt for BrowserClient
impl StorageExt for BrowserClient
Get all cookies
Set a cookie
Source§async fn storage_get(
&self,
storage_type: &str,
key: Option<&str>,
) -> Result<JsonValue, BrowserError>
async fn storage_get( &self, storage_type: &str, key: Option<&str>, ) -> Result<JsonValue, BrowserError>
Get storage value (local or session)
Source§async fn storage_set(
&self,
storage_type: &str,
key: &str,
value: &str,
) -> Result<(), BrowserError>
async fn storage_set( &self, storage_type: &str, key: &str, value: &str, ) -> Result<(), BrowserError>
Set storage value (local or session)
Source§async fn network_requests(
&self,
filter: Option<&str>,
) -> Result<Vec<Request>, BrowserError>
async fn network_requests( &self, filter: Option<&str>, ) -> Result<Vec<Request>, BrowserError>
Get network requests
Source§async fn set_viewport(
&self,
width: u32,
height: u32,
scale: Option<f32>,
) -> Result<(), BrowserError>
async fn set_viewport( &self, width: u32, height: u32, scale: Option<f32>, ) -> Result<(), BrowserError>
Set viewport size
Source§async fn set_device(&self, name: &str) -> Result<(), BrowserError>
async fn set_device(&self, name: &str) -> Result<(), BrowserError>
Set device emulation
Source§impl TabsExt for BrowserClient
impl TabsExt for BrowserClient
Source§async fn tab_new(&self, url: Option<&str>) -> Result<(), BrowserError>
async fn tab_new(&self, url: Option<&str>) -> Result<(), BrowserError>
Open a new tab, optionally with URL
Source§async fn tab_close(&self, index: Option<usize>) -> Result<(), BrowserError>
async fn tab_close(&self, index: Option<usize>) -> Result<(), BrowserError>
Close a tab by index (or current if None)
Source§async fn tab_select(&self, index: usize) -> Result<(), BrowserError>
async fn tab_select(&self, index: usize) -> Result<(), BrowserError>
Select/switch to a tab by index
Source§async fn dialog_accept(&self, text: Option<&str>) -> Result<(), BrowserError>
async fn dialog_accept(&self, text: Option<&str>) -> Result<(), BrowserError>
Accept a dialog (alert, confirm, prompt) with optional text
Source§async fn dialog_dismiss(&self) -> Result<(), BrowserError>
async fn dialog_dismiss(&self) -> Result<(), BrowserError>
Dismiss a dialog (alert, confirm, prompt)
Source§impl WaitingExt for BrowserClient
impl WaitingExt for BrowserClient
Source§async fn wait_for(&self, condition: &str) -> Result<(), BrowserError>
async fn wait_for(&self, condition: &str) -> Result<(), BrowserError>
Wait for a condition (text, element, or timeout)
Source§async fn wait_for_text(&self, text: &str) -> Result<(), BrowserError>
async fn wait_for_text(&self, text: &str) -> Result<(), BrowserError>
Wait for text to appear on page
Source§async fn wait_for_url(&self, pattern: &str) -> Result<(), BrowserError>
async fn wait_for_url(&self, pattern: &str) -> Result<(), BrowserError>
Wait for URL pattern match
Source§async fn wait_for_load(&self, state: &str) -> Result<(), BrowserError>
async fn wait_for_load(&self, state: &str) -> Result<(), BrowserError>
Wait for page load state (networkidle, domcontentloaded, load)
Source§async fn wait_for_download(
&self,
path: Option<&str>,
) -> Result<String, BrowserError>
async fn wait_for_download( &self, path: Option<&str>, ) -> Result<String, BrowserError>
Wait for download to complete, returns download path
Source§async fn wait_for_fn(&self, js: &str) -> Result<(), BrowserError>
async fn wait_for_fn(&self, js: &str) -> Result<(), BrowserError>
Wait for JavaScript function to return truthy value
Source§async fn wait_for_state(
&self,
selector: &str,
state: &str,
) -> Result<(), BrowserError>
async fn wait_for_state( &self, selector: &str, state: &str, ) -> Result<(), BrowserError>
Wait for element state (visible, hidden, attached, detached, enabled, disabled)
Auto Trait Implementations§
impl Freeze for BrowserClient
impl !RefUnwindSafe for BrowserClient
impl Send for BrowserClient
impl Sync for BrowserClient
impl Unpin for BrowserClient
impl UnsafeUnpin for BrowserClient
impl !UnwindSafe for BrowserClient
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more