user2393123
user2393123

Reputation: 23

Running the Android UiAutomator on real device

I'm able to run my Uiautomator test cases on emulator easily, on both API 16 and 17.

If I run same test case on real device it get stuck in the 1st line only.

  1. I'm not sure with the steps to run on the real device
  2. UiScrollable has some issue, I guess. When I write getUiDevice().pressHome(); it works, but after that nothing works. I'm using the same code written in the Android developer site for Uiautomator (http://developer.android.com/tools/testing/testing_ui.html)

Upvotes: 0

Views: 3620

Answers (3)

neeraj t
neeraj t

Reputation: 4764

use "adb shell uiautomator dump " command to get window dump. Then to to sd card and look for dump xml. There look for content-desc attribute of node and code according to that value. content-desc can be different on different device as for application in samsung it is "Apps" but in HTC one it is "All apps".

Upvotes: 0

Anders
Anders

Reputation: 429

Use uiautomatorviewer to dump the UI hierarchy of your device's home screen. As user2575698 says, it is likely that there is no UiObject with description "Apps".

Also you have to keep in mind that the sample from the android developer site requires the device to have the screen on and that no screen lock is present. Making sure that the screen is on can be done in the following way:

UiDevice device = getUiDevice();
if (!device.isScreenOn()) {
    device.wakeUp();
}
device.pressHome();

Screen lock can be disabled in Settings.

Upvotes: 1

user2575698
user2575698

Reputation: 11

Maybe it cannot find the object with description "Apps" on your real devices,you need to give logs for detail things

Upvotes: 0

Related Questions