Skip to content

Class: Computer

Overview

The Computer module provides computer UI automation via sub-modules: session.computer.mouse, session.computer.keyboard, session.computer.window, session.computer.app, and session.computer.screen. Use these for mouse operations, keyboard input, window management, application control, and screen capture. Legacy flat methods on session.computer (e.g. click_mouse, screenshot) are deprecated; see CHANGES.md for the full API mapping.

Requirements

  • Requires appropriate system permissions for UI automation
  • May require specific desktop environment configuration

Computer module for desktop automation. Use sub-modules: mouse, keyboard, window, app, screen.

Table of contents

Properties

Methods

Properties

typescript
app: ``ApplicationManager``
keyboard: ``KeyboardController``
mouse: ``MouseController``
screen: ``ScreenController``
window: ``WindowManager``

Methods

keyPress

keyPress(key): Promise<BoolResult>

Parameters

NameType
keystring

Returns

Promise<BoolResult>

Deprecated

Use computer.keyboard.press() instead


mouseClick

mouseClick(x, y, button?): Promise<BoolResult>

Parameters

NameType
xnumber
ynumber
button?MouseButton

Returns

Promise<BoolResult>

Deprecated

Use computer.mouse.click() instead


screenshot

screenshot(): Promise<OperationResult>

Returns

Promise<OperationResult>

Deprecated

Use computer.screen.capture() instead


toJSON

toJSON(): Record<string, unknown>

Returns

Record<string, unknown>

Best Practices

  1. Use appropriate timeouts for window operations
  2. Take screenshots for debugging and verification
  3. Handle coordinate calculations properly for different screen resolutions
  4. Verify window existence before attempting window operations
  5. Use proper key combinations and timing for keyboard operations
  6. Clean up application processes after automation tasks
  7. Handle application startup and shutdown gracefully