Skip to main content

RecordingDriver

Struct RecordingDriver 

Source
pub struct RecordingDriver<D: DeviceDriver> { /* private fields */ }
Expand description

Proxy driver that records all mutating actions.

Read-only methods (screenshot, get_ui_tree, etc.) pass through without recording.

Implementations§

Source§

impl<D: DeviceDriver> RecordingDriver<D>

Source

pub fn new(inner: D) -> Self

Source

pub fn recorded_actions(&self) -> Vec<RecordedAction>

Get all recorded actions.

Source

pub fn clear_log(&self)

Clear the recording log.

Source

pub fn to_json(&self) -> Result<String>

Serialize the log to JSON.

Trait Implementations§

Source§

impl<D: DeviceDriver> DeviceDriver for RecordingDriver<D>

Source§

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

Establish connection to the device.
Source§

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

Connect if not already connected.
Source§

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

Tap at absolute pixel coordinates.
Source§

fn swipe<'life0, 'async_trait>( &'life0 self, x1: i32, y1: i32, x2: i32, y2: i32, duration_ms: u32, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Swipe from (x1, y1) to (x2, y2) over duration_ms.
Source§

fn input_text<'life0, 'life1, 'async_trait>( &'life0 self, text: &'life1 str, clear: bool, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Type text into the currently focused field.
Source§

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

Send a single key event.
Source§

fn drag<'life0, 'async_trait>( &'life0 self, x1: i32, y1: i32, x2: i32, y2: i32, duration_ms: u32, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Drag from (x1, y1) to (x2, y2).
Source§

fn start_app<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, package: &'life1 str, activity: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Launch an application.
Source§

fn install_app<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Install an APK.
Source§

fn get_apps<'life0, 'async_trait>( &'life0 self, include_system: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<AppInfo>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List installed apps with labels.
Source§

fn list_packages<'life0, 'async_trait>( &'life0 self, include_system: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List installed package names.
Source§

fn screenshot<'life0, 'async_trait>( &'life0 self, hide_overlay: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Take a screenshot (PNG bytes).
Source§

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

Get the accessibility tree + phone state as JSON.
Source§

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

Get the device date/time.
Source§

fn supported_actions(&self) -> &HashSet<Action>

Which actions this driver supports.

Auto Trait Implementations§

§

impl<D> !Freeze for RecordingDriver<D>

§

impl<D> RefUnwindSafe for RecordingDriver<D>
where D: RefUnwindSafe,

§

impl<D> Send for RecordingDriver<D>

§

impl<D> Sync for RecordingDriver<D>

§

impl<D> Unpin for RecordingDriver<D>
where D: Unpin,

§

impl<D> UnsafeUnpin for RecordingDriver<D>
where D: UnsafeUnpin,

§

impl<D> UnwindSafe for RecordingDriver<D>
where D: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more