I am testing some new features of Android 5.0, and now is the round of the UiAutomator and the new method implemented. I've tried to search for an example/guide, then I've tried to get an instance of UiAutomator by
getSystemService()
but that was not helpful. My goal is to use executeShellCommands(String str).
Has anyone already implemented?
Just to clarify, the UiAutomation class is not part of UiAutomator (although they have similar names).
You can obtain a UiAutomation instance by calling Instrumentation#getUiAutomation(). This only works if you're running an Instrumentation-based test.
If this is part of a shell-based UiAutomator test, then you can use Runtime#exec() to execute a shell command.
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