MCPcopy Create free account
hub / github.com/e2b-dev/desktop / moveAround

Function moveAround

examples/basic-javascript/index.js:43–55  ·  view source on GitHub ↗

* @param {import('@e2b/desktop').Sandbox} desktop - E2B desktop sandbox * @param {number} width - The width of the window * @param {number} height - The height of the window

(desktop, width, height)

Source from the content-addressed store, hash-verified

41 * @param {number} height - The height of the window
42 */
43async function moveAround(desktop, width, height) {
44 console.log('\n> Randomly moving mouse and right clicking 5 times...')
45 for (let i = 0; i < 5; i++) {
46 const x = Math.floor(Math.random() * width)
47 const y = Math.floor(Math.random() * height)
48 await desktop.moveMouse(x, y)
49 console.log(` - Moved mouse to ${x}, ${y}`)
50 await desktop.rightClick()
51 console.log(` - Right clicked ${i}`)
52 console.log(' - Waiting 2 seconds...\n')
53 await wait(2000)
54 }
55}
56
57async function main() {
58 console.log('> Waiting for electron app to be ready...')

Callers 1

mainFunction · 0.85

Calls 3

moveMouseMethod · 0.80
rightClickMethod · 0.80
waitFunction · 0.70

Tested by

no test coverage detected