Simulate mouse clicks at specific coordinates. You can select the button, click type (down, up, click), number of clicks, and optional modifier keys to hold.
import Kernel from '@onkernel/sdk';const kernel = new Kernel();const kernelBrowser = await kernel.browsers.create();// Basic left click at (100, 200)await kernel.browsers.computer.clickMouse(kernelBrowser.session_id, { x: 100, y: 200,});// Double right-click while holding Shiftawait kernel.browsers.computer.clickMouse(kernelBrowser.session_id, { x: 100, y: 200, button: 'right', click_type: 'click', num_clicks: 2, hold_keys: ['Shift'],});
Press one or more key symbols (including combinations like “Ctrl+t” or “Ctrl+Shift+Tab”). Optionally hold modifiers and/or set a duration to hold keys down.
import Kernel from '@onkernel/sdk';const kernel = new Kernel();const kernelBrowser = await kernel.browsers.create();// Tap a key combinationawait kernel.browsers.computer.pressKey(kernelBrowser.session_id, { keys: ['Ctrl+t'],});// Hold keys for 250ms while also holding Altawait kernel.browsers.computer.pressKey(kernelBrowser.session_id, { keys: ['Ctrl+Shift+Tab'], duration: 250, hold_keys: ['Alt'],});
Drag by pressing a button, moving along a path of points, then releasing. You can control delay before starting, the granularity and speed of the drag via steps_per_segment and step_delay_ms, and optionally hold modifier keys.