pub struct Mouse { /* private fields */ }Expand description
Mouse controller for direct mouse input.
Provides methods for moving the mouse, clicking, and scrolling. All coordinates are in CSS pixels relative to the viewport.
§Example
ⓘ
// Move mouse to coordinates
page.mouse().move_(100.0, 200.0).await?;
// Click at coordinates
page.mouse().click(100.0, 200.0).await?;
// Right-click
page.mouse().click(100.0, 200.0).button(MouseButton::Right).await?;
// Scroll
page.mouse().wheel(0.0, 100.0).await?;
// Drag operation
page.mouse().move_(100.0, 100.0).await?;
page.mouse().down().await?;
page.mouse().move_(200.0, 200.0).steps(10).await?;
page.mouse().up().await?;Implementations§
Source§impl Mouse
impl Mouse
Sourcepub fn move_(&self, x: f64, y: f64) -> MoveBuilder<'_>
pub fn move_(&self, x: f64, y: f64) -> MoveBuilder<'_>
Move the mouse to the specified coordinates.
Returns a builder for additional options.
Sourcepub fn click(&self, x: f64, y: f64) -> ClickBuilder<'_>
pub fn click(&self, x: f64, y: f64) -> ClickBuilder<'_>
Click at the specified coordinates.
Returns a builder for additional options.
Sourcepub async fn dblclick(&self, x: f64, y: f64) -> Result<(), LocatorError>
pub async fn dblclick(&self, x: f64, y: f64) -> Result<(), LocatorError>
Double-click at the specified coordinates.
Sourcepub fn down(&self) -> DownBuilder<'_>
pub fn down(&self) -> DownBuilder<'_>
Press the mouse button at the current position.
Returns a builder for additional options.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Mouse
impl !RefUnwindSafe for Mouse
impl Send for Mouse
impl Sync for Mouse
impl Unpin for Mouse
impl !UnwindSafe for Mouse
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