Mouse Move
curl --request POST \
--url https://api.example.com/browser/sessions/{id}/mouse/move \
--header 'Content-Type: application/json' \
--data '
{
"x": 123,
"y": 123,
"selector": "<string>",
"timeout": 123,
"index": 123,
"holdKeys": [
"<string>"
],
"steps": 123,
"durationMs": 123
}
'import requests
url = "https://api.example.com/browser/sessions/{id}/mouse/move"
payload = {
"x": 123,
"y": 123,
"selector": "<string>",
"timeout": 123,
"index": 123,
"holdKeys": ["<string>"],
"steps": 123,
"durationMs": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
x: 123,
y: 123,
selector: '<string>',
timeout: 123,
index: 123,
holdKeys: ['<string>'],
steps: 123,
durationMs: 123
})
};
fetch('https://api.example.com/browser/sessions/{id}/mouse/move', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/browser/sessions/{id}/mouse/move",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'x' => 123,
'y' => 123,
'selector' => '<string>',
'timeout' => 123,
'index' => 123,
'holdKeys' => [
'<string>'
],
'steps' => 123,
'durationMs' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/browser/sessions/{id}/mouse/move"
payload := strings.NewReader("{\n \"x\": 123,\n \"y\": 123,\n \"selector\": \"<string>\",\n \"timeout\": 123,\n \"index\": 123,\n \"holdKeys\": [\n \"<string>\"\n ],\n \"steps\": 123,\n \"durationMs\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/browser/sessions/{id}/mouse/move")
.header("Content-Type", "application/json")
.body("{\n \"x\": 123,\n \"y\": 123,\n \"selector\": \"<string>\",\n \"timeout\": 123,\n \"index\": 123,\n \"holdKeys\": [\n \"<string>\"\n ],\n \"steps\": 123,\n \"durationMs\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/browser/sessions/{id}/mouse/move")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"x\": 123,\n \"y\": 123,\n \"selector\": \"<string>\",\n \"timeout\": 123,\n \"index\": 123,\n \"holdKeys\": [\n \"<string>\"\n ],\n \"steps\": 123,\n \"durationMs\": 123\n}"
response = http.request(request)
puts response.read_body{
"x": 123,
"y": 123
}Browser Sessions
Mouse Move
Move the cursor to coordinates or a CSS selector, dispatching interpolated mousemove events so hover-based UI fires correctly.
POST
/
browser
/
sessions
/
{id}
/
mouse
/
move
Mouse Move
curl --request POST \
--url https://api.example.com/browser/sessions/{id}/mouse/move \
--header 'Content-Type: application/json' \
--data '
{
"x": 123,
"y": 123,
"selector": "<string>",
"timeout": 123,
"index": 123,
"holdKeys": [
"<string>"
],
"steps": 123,
"durationMs": 123
}
'import requests
url = "https://api.example.com/browser/sessions/{id}/mouse/move"
payload = {
"x": 123,
"y": 123,
"selector": "<string>",
"timeout": 123,
"index": 123,
"holdKeys": ["<string>"],
"steps": 123,
"durationMs": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
x: 123,
y: 123,
selector: '<string>',
timeout: 123,
index: 123,
holdKeys: ['<string>'],
steps: 123,
durationMs: 123
})
};
fetch('https://api.example.com/browser/sessions/{id}/mouse/move', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/browser/sessions/{id}/mouse/move",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'x' => 123,
'y' => 123,
'selector' => '<string>',
'timeout' => 123,
'index' => 123,
'holdKeys' => [
'<string>'
],
'steps' => 123,
'durationMs' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/browser/sessions/{id}/mouse/move"
payload := strings.NewReader("{\n \"x\": 123,\n \"y\": 123,\n \"selector\": \"<string>\",\n \"timeout\": 123,\n \"index\": 123,\n \"holdKeys\": [\n \"<string>\"\n ],\n \"steps\": 123,\n \"durationMs\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/browser/sessions/{id}/mouse/move")
.header("Content-Type", "application/json")
.body("{\n \"x\": 123,\n \"y\": 123,\n \"selector\": \"<string>\",\n \"timeout\": 123,\n \"index\": 123,\n \"holdKeys\": [\n \"<string>\"\n ],\n \"steps\": 123,\n \"durationMs\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/browser/sessions/{id}/mouse/move")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"x\": 123,\n \"y\": 123,\n \"selector\": \"<string>\",\n \"timeout\": 123,\n \"index\": 123,\n \"holdKeys\": [\n \"<string>\"\n ],\n \"steps\": 123,\n \"durationMs\": 123\n}"
response = http.request(request)
puts response.read_body{
"x": 123,
"y": 123
}Overview
Dispatches a series ofmousemove events along a straight line from the cursor’s previous position to the target, so the DOM sees a realistic mouseenter / mousemove / mouseleave cascade on every element the cursor passes over. The endpoint supports two modes:
- Coordinates — move to
(x, y)in viewport CSS pixels. - Selector — move to the center of the element matched by a CSS selector. Waits for visibility.
(x, y) or selector, never both.
Path Parameters
string
required
Browser session ID (UUID).
Body
integer
X coordinate in viewport CSS pixels. Required together with
y when selector is omitted.integer
Y coordinate in viewport CSS pixels. Required together with
x when selector is omitted.string
CSS selector of the element to hover. Mutually exclusive with
x/y. Moves to the center of the element’s bounding box.integer
default:"5000"
How long to wait (ms) for the selector to become visible. Ignored when using coordinates.
integer
default:"0"
Which match to target when the selector resolves to multiple elements (0-based).
string[]
Modifier keys held for the duration of the move. Each value must be one of
Shift, Control, Alt, Meta.integer
default:"10"
Number of intermediate mousemove events dispatched along the path.
1 teleports — useful for deterministic tests, but does not fire mouseenter / mousemove on elements in between. Capped at 100.integer
default:"150"
Total time (ms) to complete the move. Step delay is
durationMs / steps.Example Request
curl -X POST "https://api.scrapengine.io/api/v1/browser/sessions/0f2b1f6a-88ac-4d25-bc58-67a6f4b4a001/mouse/move" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "x": 400, "y": 300 }'
curl -X POST "https://api.scrapengine.io/api/v1/browser/sessions/.../mouse/move" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "selector": "nav .dropdown-trigger" }'
await fetch(
"https://api.scrapengine.io/api/v1/browser/sessions/.../mouse/move",
{
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({ selector: "nav .dropdown-trigger" }),
},
);
import requests
requests.post(
"https://api.scrapengine.io/api/v1/browser/sessions/.../mouse/move",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"selector": "nav .dropdown-trigger"},
)
Response
Success Response (200)
integer
X coordinate the cursor landed on (in viewport CSS pixels). For selector mode, this is the center of the resolved element.
integer
Y coordinate the cursor landed on (in viewport CSS pixels).
{
"x": 400,
"y": 300
}
Error Responses
| Status | Description |
|---|---|
400 | Invalid body — both modes provided, neither provided, steps/durationMs out of range, bad modifier. |
401 | Unauthorized — invalid or missing API key. |
404 | Session not found, or selector did not become visible before timeout. |
503 | The browser session is temporarily unreachable. |
Notes
- Cursor position is tracked per session. The move starts from the last known cursor position (initially
(0, 0)). A subsequentmouse/clickat a different coord will also update the tracked position, so chainedmove → click → moveflows look continuous. - Interpolation fires the full DOM cascade.
mouseenterandmouseleavefire on every element the cursor crosses, along with intermediatemousemoveevents — necessary for hover-activated menus, tooltips, and many:hoverCSS effects. - For deterministic tests, pass
steps: 1, durationMs: 0to teleport. For scraping hover-triggered UI, stick with the defaults. - Modifier keys are held for every intermediate event, not just the final position.
Was this page helpful?