pub struct Droid { /* private fields */ }Expand description
The main entry point for interacting with an Android device.
The Droid struct holds the connection to a device and provides methods
for performing actions like tapping, swiping, and image recognition.
Implementations§
Source§impl Droid
impl Droid
Sourcepub fn new(config: DroidConfig) -> Result<Self>
pub fn new(config: DroidConfig) -> Result<Self>
Creates a new Droid instance and connects to a device.
Sourcepub fn touch(&mut self, target: Target) -> TouchBuilder<'_>
pub fn touch(&mut self, target: Target) -> TouchBuilder<'_>
Initiates a touch action on a target.
Returns a TouchBuilder to configure and execute the action.
§Example
// Tap an image target twice.
droid.touch(target).times(2).execute()?;Sourcepub fn swipe(&mut self, start: Target, end: Target) -> SwipeBuilder<'_>
pub fn swipe(&mut self, start: Target, end: Target) -> SwipeBuilder<'_>
Initiates a swipe action between two targets.
Returns a SwipeBuilder to configure and execute the action.
Sourcepub fn wait_for(&mut self, target: Target) -> WaitBuilder<'_>
pub fn wait_for(&mut self, target: Target) -> WaitBuilder<'_>
Waits for a target to appear on the screen.
Returns a WaitBuilder to configure timeouts and execute the wait operation.
The operation succeeds by returning the Point where the target was found.
Sourcepub fn text(&mut self, text: &str) -> TextBuilder<'_>
pub fn text(&mut self, text: &str) -> TextBuilder<'_>
Initiates a text input action.
Returns a TextBuilder to execute the action.
Sourcepub fn snapshot<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
pub fn snapshot<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
Takes a screenshot of the current device screen and saves it to a file.
§Arguments
path- The path where the screenshot image will be saved.
Sourcepub fn keyevent(&mut self, key_code: KeyCode) -> KeyeventBuilder<'_>
pub fn keyevent(&mut self, key_code: KeyCode) -> KeyeventBuilder<'_>
Initiates a key event action (e.g., pressing Home or Back).
Returns a KeyeventBuilder to configure and execute the action.
Auto Trait Implementations§
impl Freeze for Droid
impl RefUnwindSafe for Droid
impl Send for Droid
impl Sync for Droid
impl Unpin for Droid
impl UnwindSafe for Droid
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.