pub struct BiDiSession { /* private fields */ }Expand description
Lock-free BiDi session using DashMap for pending/events, ArcSwap for context.
Implementations§
Source§impl BiDiSession
impl BiDiSession
pub fn new(send_tx: UnboundedSender<String>, timeout_ms: u64) -> Self
pub fn context(&self) -> Option<String>
Sourcepub fn handle_message(&self, data: &str) -> bool
pub fn handle_message(&self, data: &str) -> bool
Process a raw message from the transport. Returns true if handled.
Sourcepub async fn send(&self, method: &str, params: Value) -> Result<Value>
pub async fn send(&self, method: &str, params: Value) -> Result<Value>
Send a BiDi command and wait for the response.
pub fn on(&self, method: &str, handler: Arc<dyn Fn(Value) + Send + Sync>)
Sourcepub async fn get_or_create_context(&self) -> Result<String>
pub async fn get_or_create_context(&self) -> Result<String>
Get or create a browsing context.
pub fn set_context(&self, context_id: &str)
pub async fn capture_screenshot(&self) -> Result<String>
pub async fn evaluate(&self, expression: &str) -> Result<Value>
pub async fn get_html(&self) -> Result<String>
pub async fn perform_actions(&self, actions: Value) -> Result<()>
pub async fn click_point(&self, x: f64, y: f64) -> Result<()>
pub async fn insert_text(&self, text: &str) -> Result<()>
pub fn destroy(&self)
Auto Trait Implementations§
impl !Freeze for BiDiSession
impl !RefUnwindSafe for BiDiSession
impl Send for BiDiSession
impl Sync for BiDiSession
impl Unpin for BiDiSession
impl UnsafeUnpin for BiDiSession
impl !UnwindSafe for BiDiSession
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