Last Verified: 2025-01-27
Package:
hopx-ai on PyPI
Overview
TheDesktop resource provides desktop automation capabilities for sandboxes with GUI support. Use this resource for GUI automation, taking screenshots, controlling mouse/keyboard, managing windows, and accessing VNC.
Desktop features require a desktop-enabled template. Not all templates support desktop operations.
Access
VNC Methods
start_vnc
Start VNC server.
display(int, optional): Display number (default:1)password(str, optional): VNC password
VNCInfo - VNC server information with url, port, password
Example:
stop_vnc
Stop VNC server.
get_vnc_status
Get VNC server status.
get_vnc_url
Get VNC URL (convenience method).
Mouse Methods
click
Click at position.
x(int): X coordinatey(int): Y coordinatebutton(str, optional): Mouse button ('left','right','middle') (default:'left')clicks(int, optional): Number of clicks (default:1)
move
Move mouse cursor to position.
drag
Drag from one position to another.
scroll
Scroll mouse wheel.
amount(int): Scroll amountdirection(str, optional):'up'or'down'(default:'down')
Keyboard Methods
type
Type text.
text(str): Text to typedelay_ms(int, optional): Delay between keystrokes in milliseconds (default:10)
press
Press a key.
key(str): Key name (e.g.,'Enter','Escape','Tab')
combination
Press key combination.
modifiers(List[str]): Modifier keys (e.g.,['Ctrl', 'Alt'])key(str): Key to press
Clipboard Methods
set_clipboard
Set clipboard content.
get_clipboard
Get clipboard content.
Screenshot Methods
screenshot
Capture full screen screenshot.
bytes - Screenshot image as PNG bytes
Example:
screenshot_region
Capture screenshot of specific region.
x(int): X coordinate of top-left cornery(int): Y coordinate of top-left cornerwidth(int): Region widthheight(int): Region height
Window Methods
get_windows
Get list of all windows.
List[WindowInfo] - List of window information objects
Expected Output:
focus_window
Focus (activate) window.
close_window
Close window.
Examples
Example 1: Taking Screenshots
Example 2: Mouse and Keyboard Automation
Related Classes
See Also
- Core Concepts: Desktop - Learn about desktop automation
- Sandbox Class - Access desktop via
sandbox.desktop
Related
- Desktop Automation - Learn about desktop automation
- Sandbox Class - Access desktop via
sandbox.desktop
Next Steps
- Learn about VNC Server for remote desktop access
- Explore Screenshots for visual verification
- Review Mouse Control and Keyboard Control for GUI automation
- CLI System Commands - System operations from CLI

