Examples for using Browser Vision CDP extras from your own automation code.
Browser Vision extends the Chrome DevTools Protocol with two user-facing input capabilities:
- Human Type:
Input.typeText, a Human Type text entry command. - VirtualMouse:
VirtualMouse.create,configure,move,click, anddestroy, virtual cursor with human-like movement.
These commands are Browser Vision extensions. They are not available in stock Chromium or Chrome.
- Browser Vision running with remote CDP access exposed.
- Node.js 18+ for JavaScript examples.
- Python 3.9+ for Python examples.
Examples default to:
http://127.0.0.1:9222
Override it with CDP_ENDPOINT:
CDP_ENDPOINT=http://127.0.0.1:9222 npm --prefix examples/javascript run human-type
CDP_ENDPOINT=http://127.0.0.1:9222 python3 examples/python/human_type.pyInstall dependencies:
npm --prefix examples/javascript installRun Human Type:
npm --prefix examples/javascript run human-typeRun VirtualMouse:
npm --prefix examples/javascript run virtual-mouseInstall dependencies:
python3 -m venv /tmp/cdp-extras-venv
/tmp/cdp-extras-venv/bin/pip install -r examples/python/requirements.txtRun Human Type:
/tmp/cdp-extras-venv/bin/python examples/python/human_type.pyRun VirtualMouse:
/tmp/cdp-extras-venv/bin/python examples/python/virtual_mouse.py| Feature | JavaScript | Python |
|---|---|---|
| Human Type | examples/javascript/human-type.mjs |
examples/python/human_type.py |
| VirtualMouse | examples/javascript/virtual-mouse.mjs |
examples/python/virtual_mouse.py |
Input.typeText types into the currently focused editable element.
await client.send("Input.typeText", {
text: "Typed by Browser Vision Human Type",
minDelay: 55,
maxDelay: 130,
});Parameters:
text: text to type.minDelay: optional minimum inter-key delay in milliseconds.maxDelay: optional maximum inter-key delay in milliseconds.
Minimal flow:
await client.send("VirtualMouse.create", {
speed: 1.2,
x: 100,
y: 100,
targetWidth: 32,
noiseScale: 1.0,
includeReaction: true,
exactFinal: true,
seed: 12345,
});
await client.send("VirtualMouse.move", { x: 500, y: 240 });
await client.send("VirtualMouse.click", { duration: 40 });
await client.send("VirtualMouse.destroy");Commands:
VirtualMouse.create: creates the per-page virtual mouse.VirtualMouse.configure: changes movement settings for later commands.VirtualMouse.move: moves tox,yin CSS pixels relative to the main frame viewport.VirtualMouse.click: moves if coordinates are provided, then left-clicks. Omitted coordinates use the remembered cursor position.VirtualMouse.destroy: removes the virtual cursor.
Useful options:
speed: movement speed scale,0..4;0means teleport.targetWidth: target size in CSS pixels,8..96.noiseScale: movement noise multiplier,0..3;0disables noise.includeReaction: includes a reaction delay before movement.exactFinal: ends exactly at the requested point when true.seed: deterministic trajectory variation.duration:VirtualMouse.clickhold time between mouse down and mouse up, valid0..1000ms.
See docs/using-from-your-library.md for the
copyable integration pattern and wrapper guidance.
