Appearance
Class: Computer
📖 Related Tutorial
- Computer Automation Guide - Complete guide to computer UI automation and control
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
| Name | Type |
|---|---|
key | string |
Returns
Promise<BoolResult>
Deprecated
Use computer.keyboard.press() instead
mouseClick
▸ mouseClick(x, y, button?): Promise<BoolResult>
Parameters
| Name | Type |
|---|---|
x | number |
y | number |
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
- Use appropriate timeouts for window operations
- Take screenshots for debugging and verification
- Handle coordinate calculations properly for different screen resolutions
- Verify window existence before attempting window operations
- Use proper key combinations and timing for keyboard operations
- Clean up application processes after automation tasks
- Handle application startup and shutdown gracefully