Reputation: 265
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?
Upvotes: 8
Views: 2722
Reputation: 1050
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.
Upvotes: 8