INNER CODE UNIT · Rust
drag
keon/browser-control · src/actions.rs:61
pub async fn drag(c: &mut Cdp, x1: i64, y1: i64, x2: i64, y2: i64) -> Result<()> {
c.call(
"Input.dispatchMouseEvent",
json!({"type":"mousePressed","x":x1,"y":y1,"button":"left","clickCount":1}),
true,
)
.await?;
c.call(
"Input.dispatchMouseEvent",
json!({"type":"mouseMoved","x":x2,"y":y2,"button":"left"}),
true,
)
.await?;
c.call(
"Input.dispatchMouseEvent",
json!({"type":"mouseReleased","x":x2,"y":y2,"button":"left","clickCount":1}),
true,
)