Machine.local] or [Machine.android], then get apps, windows, and
accessibility nodes from it — every handle stays bound to the machine it
came from, and the same code drives any backend.
Mouse, keyboard, and clipboard access are flat methods on the machine
itself (moveMouse, typeText, getClipboardString, …).
Canonical coordinate space
This is the reference description of the coordinate space used throughout the library.Window.boundingBox(), AccessibilityNode.boundingBox(),
screenshots, and grounding-model output all live in this same space, so
coordinates round-trip between them without conversion.
Absolute coordinates live on the global desktop: top-left origin at
(0, 0) on the primary monitor (on Android, the device screen), with the
OS’s native units. The unit is not the same on every OS:
- Windows, Linux, and Android use physical pixels (raw hardware pixels).
- macOS uses logical points — on a 2× Retina display one point spans two hardware pixels, so coordinates are half the physical-pixel count.
x, y >= 0. Use
[Machine.screens] / [Window.screen] to discover where the
addressable region actually is.
Constructor
Returns
Machine
Properties
string
required
A human-readable identifier for the machine: the local hostname, or
the adb serial (
host:port) for an Android device.Os
required
The operating system this machine runs:
'macos' | 'windows' | 'linux' | 'android'.Methods
android()
host:port).
The device must be reachable over adb and run the uiautomator2
(appium) server; appiumBase is its base URL and defaults to the
standard local forward (http://localhost:6790). The appium URL is
per device: when several devices are connected, forward a distinct
local port for each.
Unlike the local arm, each Android machine owns its emulated cursor
and modifier state, so input state is per-handle.
Parameters
string
required
null | string
Returns
Machine
app()
com.android.chrome).
Parameters
string
required
Returns
App
apps()
Returns
App[]
asAndroid()
null
when this machine is the local desktop.
Everything cross-platform lives on [Machine] and the handles it
returns; this escape hatch is only for operations that have no
desktop counterpart.
Returns
null | AndroidExtras
clearClipboard()
defaultBrowser()
Returns
App
dir()
createMissing — at path. Path resolution
as in [Machine.file].
Parameters
string
required
boolean
required
Returns
Directory
file()
createMissing — at path.
Local: an absolute path is used as-is. A relative path is joined
to the SimularFiles root (.. is kept — this is a default base,
not a sandbox).
Android: path must be absolute (there is no working directory on
the device to resolve against).
Parameters
string
required
boolean
required
Returns
File
focusedRoot()
Machine.systemRoot].
Returns
AccessibilityNode
focusedWindow()
null when nothing is focused (desktop: no focused window;
Android: no visible task, e.g. the screen is off) rather than
treating that as an error.
Returns
null | Window
foregroundApp()
Returns
Instance
fuzzyApp()
query against the machine’s
app list (launcher names locally, package names on Android).
Parameters
string
required
Returns
App
getClipboardImage()
null if the clipboard
doesn’t contain image data.
Returns
null | Image
getClipboardString()
null if the clipboard
doesn’t contain string data or is empty.
Returns
null | string
key()
Machine.keyRaw] method, if you want to
enter a keycode.
Some of the keys are specific to a platform.
Parameters
Key
required
Direction
required
keyOther()
Parameters
number
required
Direction
required
keyRaw()
Machine.key] method, if you
just want to enter a specific key and don’t want to worry about the
layout/keymap. Windows only: If you want to enter the keycode
(scancode) of an extended key, you need to set the high byte for the
extended key too. You can for example do:
keyRaw(0xE01D, Direction.Click) to simulate RControl.
Parameters
number
required
Direction
required
keyUnicode()
Parameters
string
required
Direction
required
local()
Returns
Machine
loopback()
Parameters
AudioFormat
required
Returns
Loopback
mainScreen()
Returns
Screen
microphone()
Machine.loopback].
Parameters
AudioFormat
required
Returns
Microphone
mouseButton()
Machine.moveMouse].
Parameters
Button
required
Direction
required
mouseLocation()
Machine]). On Android this is the emulated
cursor’s recorded location.
Returns
[number, number]
moveMouse()
(x, y) is in the global desktop space
described on [Machine]: top-left origin at (0, 0), OS-native
units, and secondary monitors arranged above / to the left of the
primary may have negative coordinates.
With relative coordinates, a positive x moves the cursor x
pixels to the right; a positive y moves it down.
Parameters
number
required
number
required
Coordinate
required
nodeAtPoint()
(x, y) via
the platform hit-test, or null when the point has no accessible
element (empty desktop, gaps between controls). Throws on Android (no
accessibility hit-test channel) and on genuine backend failures.
(x, y) are in the canonical coordinate space (see [Machine]) — the
same space .boundingBox() and mouseLocation use.
Parameters
number
required
number
required
Returns
null | AccessibilityNode
pasteText()
Parameters
string
required
player()
Machine.loopback].
Returns
AudioPlayer
screenFromMouse()
Returns
Screen
screens()
Returns
Screen[]
screenshotCropped()
Machine]).
Local: a native cropped capture. Android: the full screen is captured
and cropped to the region, which must lie entirely within the screen
(hideCursor is ignored).
Parameters
number
required
number
required
number
required
number
required
boolean
required
Returns
Screenshot
scroll()
Parameters
number
required
number
required
setClipboardImage()
ClipboardContent] snapshot of what the clipboard held
before this call (see [Machine.setClipboardString]).
Parameters
Image
required
Returns
ClipboardContent
setClipboardString()
ClipboardContent] snapshot of what the clipboard held
before this call. Nothing is restored automatically; see the
snapshot’s docs for how to write it back (and the
one-format-per-write caveat).
Parameters
string
required
Returns
ClipboardContent
snapshot()
Returns
string
systemRoot()
Returns
AccessibilityNode
tempDir()
Directory.delete] when done.
Returns
Directory
typeText()
Machine.key] method instead.
Parameters
string
required
windowAtPoint()
(x, y), or
null when no window sits under the point.
(x, y) are in the canonical coordinate space (see [Machine]) — the
same space Window.boundingBox and mouseLocation use, so a cursor
location can be passed straight in.
Platform notes:
- macOS: returns the containing
AXWindowof the element under the cursor — the window itself, not the whole application. - Windows: returns the top-level window (
GA_ROOT) of whatever control sits under the cursor. - Linux: always
null(no per-point window hit-test). - Android: throws — tasks have no per-point hit-test.
Parameters
number
required
number
required
Returns
null | Window
windows()
Returns
Window[]
