Skip to main content

Driver

Trait Driver 

Source
pub trait Driver: Send + Sync {
Show 33 methods // Required methods fn platform(&self) -> Platform; fn tree<'life0, 'async_trait>( &'life0 self, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<A11yNode, ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<bool, ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn find_one<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<Option<A11yNode>, ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn find_all<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<Vec<A11yNode>, ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn find_norm_coord<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, ) -> Pin<Box<dyn Future<Output = Result<Option<(f64, f64)>, ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn find_text_by_ocr<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, text: &'life1 str, locales: &'life2 [String], recognition_level: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<Option<OcrFrame>, ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn system_popups<'life0, 'async_trait>( &'life0 self, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<Vec<SystemPopup>, ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn system_popup_action<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, popup_id: &'life1 str, button_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool, ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn wait_for<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, timeout: Duration, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<A11yNode, ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn tap<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<ActOutcome, ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn tap_with_mode<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, mode: TapMode, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn tap_at_norm_coord<'life0, 'async_trait>( &'life0 self, nx: f64, ny: f64, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn tap_by_id<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn double_tap<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn long_press<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, duration: Duration, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<PressTiming, ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn fill<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, selector: &'life1 Selector, text: &'life2 str, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn clear<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn press_key<'life0, 'async_trait>( &'life0 self, key: KeyName, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn scroll<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, direction: SwipeDirection, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn swipe_once<'life0, 'async_trait>( &'life0 self, direction: SwipeDirection, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn swipe_at_norm_coord<'life0, 'async_trait>( &'life0 self, from: (f64, f64), to: (f64, f64), ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn hide_keyboard<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn back<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn set_orientation<'life0, 'async_trait>( &'life0 self, orientation: Orientation, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn foreground<'life0, 'life1, 'async_trait>( &'life0 self, bundle_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn webview_eval<'life0, 'life1, 'async_trait>( &'life0 self, js: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Value, ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; // Provided methods fn as_ios_driver(&self) -> Option<&IosDriver> { ... } fn set_target_bundle_id(&mut self, _bundle: &str) { ... } fn set_auto_activate(&mut self, _activate: bool) { ... } fn set_force_key_events(&mut self, _force: bool) { ... } fn set_session_id(&mut self, _id: Option<String>) { ... } fn tap_burst<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, times: u32, _interval_ms: Option<u32>, _hold_ms: Option<u32>, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... }
}
Expand description

Sense + act capabilities for a single device. Two-trait architecture pair with smix_sdk::DeviceControl (sim/host control in smix-sdk).

Signatures intentionally match iOS impl (IosDriver inherent methods) 1:1 so the trait impl is a pure delegation layer.

Required Methods§

Source

fn platform(&self) -> Platform

Platform identifier — Platform::Ios or Platform::Android.

Source

fn tree<'life0, 'async_trait>( &'life0 self, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<A11yNode, ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fetch full a11y tree (GET /tree).

Source

fn find<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<bool, ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Boolean existence quick-probe.

Source

fn find_one<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<Option<A11yNode>, ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Resolve selector → single matching node.

Source

fn find_all<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<Vec<A11yNode>, ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Resolve selector → all matching nodes.

Source

fn find_norm_coord<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, ) -> Pin<Box<dyn Future<Output = Result<Option<(f64, f64)>, ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Resolve selector → centroid as viewport-normalized (nx, ny).

Source

fn find_text_by_ocr<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, text: &'life1 str, locales: &'life2 [String], recognition_level: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<Option<OcrFrame>, ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Apple Vision / ML Kit OCR find text in current screenshot. recognition_level is "accurate" or "fast".

Source

fn system_popups<'life0, 'async_trait>( &'life0 self, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<Vec<SystemPopup>, ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List visible system-level popups (alerts, permission dialogs).

Source

fn system_popup_action<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, popup_id: &'life1 str, button_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool, ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Tap a button on a system popup by id.

Source

fn wait_for<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, timeout: Duration, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<A11yNode, ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Wait until selector resolves (returns matched node when ready).

Source

fn tap<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<ActOutcome, ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Tap a selector, and report what the touch landed on.

A platform that cannot answer says so with ActOutcome::unjudged() rather than with a bare success. “I could not tell” is a different fact from “it landed”, and only one of them is what a caller reads out of a tap that returned without error.

Source

fn tap_with_mode<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, mode: TapMode, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Tap with explicit mode (Path A vs Path B).

Source

fn tap_at_norm_coord<'life0, 'async_trait>( &'life0 self, nx: f64, ny: f64, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Tap at viewport-normalized coordinate (escape hatch).

Source

fn tap_by_id<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Tap by accessibility identifier via the swift /tap-by-id route (IOHID synthesize at element-frame center).

Source

fn double_tap<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Double-tap a selector.

Source

fn long_press<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, duration: Duration, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<PressTiming, ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Long-press a selector for duration.

Returns when the touch was held, on this host’s clock, so a caller capturing frames alongside can tell whether they fall inside the press. A platform whose runner cannot report the bounds returns [PressTiming::unplaceable] — which reads as “I cannot tell”, not as a press that happened at time zero.

Source

fn fill<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, selector: &'life1 Selector, text: &'life2 str, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Fill text into a focused / matched input.

Source

fn clear<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Clear text from a focused / matched input.

Source

fn press_key<'life0, 'async_trait>( &'life0 self, key: KeyName, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Press a named key (Return / Tab / Backspace / etc).

Source

fn scroll<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, direction: SwipeDirection, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Scroll until a selector is visible.

Source

fn swipe_once<'life0, 'async_trait>( &'life0 self, direction: SwipeDirection, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

One-shot swipe in a direction (no probe loop).

Source

fn swipe_at_norm_coord<'life0, 'async_trait>( &'life0 self, from: (f64, f64), to: (f64, f64), ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Swipe between two viewport-normalized coords.

Source

fn hide_keyboard<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Dismiss the keyboard.

Source

fn back<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Trigger “back” gesture (iOS edge-swipe / Android KEYCODE_BACK).

Source

fn set_orientation<'life0, 'async_trait>( &'life0 self, orientation: Orientation, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Rotate the device.

Source

fn foreground<'life0, 'life1, 'async_trait>( &'life0 self, bundle_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Bring app to foreground.

Source

fn webview_eval<'life0, 'life1, 'async_trait>( &'life0 self, js: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Value, ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Evaluate JavaScript in a WebView (iOS: fixture bridge :28080; Android: Chrome DevTools Protocol via adb forward).

Provided Methods§

Source

fn as_ios_driver(&self) -> Option<&IosDriver>

iOS-only escape hatch: access IosDriver’s inherent runner() for capsule recording (start_record / stop_record) + describe() aggregation. Android impl returns None. Default None so non-iOS impls don’t need to implement.

Source

fn set_target_bundle_id(&mut self, _bundle: &str)

Set the target bundle id sent to the runner as the App-Bundle-Id header on every request. iOS rebinds XCUIApplication(bundleIdentifier:) per request with it; Android spells <pkg>:id/<tag> resource ids with it. Both override; the default no-op is for impls that talk to neither.

Source

fn set_auto_activate(&mut self, _activate: bool)

Enable App-Activate: true header on every request so the iOS runner calls .activate() on the resolved target before operating.

iOS-only by design, not by omission: Android foregrounds with an am start shell command, which is a once-per-session action rather than something to repeat on every request.

Source

fn set_force_key_events(&mut self, _force: bool)

Force key-event dispatch for text input, bypassing a11y-focus resolution. Wires as the Input-Dispatch-Mode: key-events header. Default no-op.

Source

fn set_session_id(&mut self, _id: Option<String>)

Attach a Session-Id header to every subsequent request. Set to Some(id) after POST /session/open; set to None to revert to the legacy per-request rebind path (which is rate-limited to at most one .activate() per 5 s per bundle-id). Default no-op — only impls backed by an HTTP runner override.

Source

fn tap_burst<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 Selector, times: u32, _interval_ms: Option<u32>, _hold_ms: Option<u32>, include: Option<IncludeScope>, ) -> Pin<Box<dyn Future<Output = Result<(), ExpectationFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Tap an element (default mode = element-anchored coord tap). Tap a selector times times, spaced on the event timeline.

Default is one resolve per touch through Self::tap, which is what every platform can already do. A runner that can pack the touches into one synthesise overrides this and gets an interval the caller states rather than one the round trip decides.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§