allwright

API ReferenceRustDesktop

Desktop

Native macOS application automation through the installable desktop-mac XCUITest plugin. Windows and Linux are not available yet.

desktop::mac::connect

FunctionSince v0.1.21

Connects to the local macOS desktop and starts the bundled XCUITest runner automatically. Requires macOS 14 or newer, Xcode, and UI automation permission for the process running Xcode.

pub async fn connect(options: DesktopMacConnectOptions) -> Result<MacDesktop>

Example

let mac = desktop::mac::connect(DesktopMacConnectOptions::default()).await?;

MacDesktop::launch

MethodSince v0.1.21

Launches an installed macOS application by bundle identifier. The returned app supports native locators, actions, text reads, waits, screenshots, and accessibility snapshots.

pub async fn launch(&self, options: DesktopMacLaunchOptions) -> Result<MacApp>

Example

let app = mac.launch(DesktopMacLaunchOptions { app_id: "com.apple.TextEdit".into(), terminate_running: false, timeout_ms: None }).await?;

MacApp locators and actions

MethodSince v0.1.21

Uses native XCUITest selectors and the Playwright-style role, text, label, and test-id locator subset. App methods include click, fill, focus, press, count, text_content, inner_text, wait_for_selector, screenshot, and accessibility_snapshot.

pub fn locator(&self, selector: impl Into<String>) -> MacLocator
pub fn get_by_role(&self, role: &str, options: RoleOptions) -> MacLocator