I want to know can we use UIAutomator in our applications ? I want write an app that open another application, write some Text in that application EditText and then press some buttons (like open Hangout and write a text on it and send the message). Can you suggest me how can I do this?
I have searched the net and I could only find out I can test my UI with UIAutomator, but I don't know if I can use it to write an Android application (not jar file) and run it on my Android device to do this.
To launch the uiautomatorviewer tool: Launch the target app on a physical device. Connect the device to your development machine. Open a terminal window and navigate to the <android-sdk>/tools/ directory.
This class is deprecated. It is no longer necessary to extend UiAutomatorTestCase.
UI Automator Based on the features mentioned before, Appium is the most popular and preferred choice for Mobile Automation for Android devices. The most important reason for Appium as a preferred choice is because the same programming language can be used to automate both iOS and Android operating systems.
This isn't possible.
UiAutomator 2.0 relies on Instrumentation which is only available when you run your test using am instrument ...
. Regular (non-test) apps don't have access to Instrumentation.
Shell-based UiAutomator is similar. You execute tests using adb shell uiautomator runtest ...
and UiAutomatorTestRunner takes advantage of the fact that it is running as the shell user to do things that normal apps don't have permission to do.
If you use Runtime#exec(..)
to call either am instrument
or uiautomator runtest
, the command won't run as the shell user (it will use your application's uid), and will fail because it doesn't have the necessary permissions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With