I have the following script for typing \'33\' into the Calculator, in Android, using UiAutomator. However, only the first \'3\' is accepted, the second press is entirely ig
I have the same problem, looks like its looking for another UI element that have the same text. I'm trying to automate the creation of an Alarm but when the time is at for example 4:45 pm. Uiautomator will click the right Button.
clickByText("4");
clickByText("4");
clickByText("5");
clickByText("PM");
clickByText("OK");
private void clickByText(String text) throws UiObjectNotFoundException {
UiObject obj = new UiObject(new UiSelector().text(text));
obj.click();
}
Here is the Log for the first "4" click:
07-04 16:54:05.259: I/QueryController(25605): Matched selector: UiSelector[TEXT=4] <<==>> [android.view.accessibility.AccessibilityNodeInfo@592f1; boundsInParent: Rect(0, 0 - 202, 129); boundsInScreen: Rect(56, 508 - 258, 637); packageName: com.android.deskclock; className: android.widget.Button; text: 4; contentDescription: null; checkable: false; checked: false; focusable: true; focused: false; selected: false; clickable: true; longClickable: false; enabled: true; password: false; scrollable: false; [ACTION_FOCUS, ACTION_SELECT, ACTION_CLEAR_SELECTION, ACTION_CLICK, ACTION_ACCESSIBILITY_FOCUS, ACTION_NEXT_AT_MOVEMENT_GRANULARITY, ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY]]
Here is the Log for the second "4" click:
07-04 16:54:07.798: I/QueryController(25605): Matched selector: UiSelector[TEXT=4] <<==>> [android.view.accessibility.AccessibilityNodeInfo@5bffd; boundsInParent: Rect(0, 0 - 66, 90); boundsInScreen: Rect(191, 264 - 257, 354); packageName: com.android.deskclock; className: android.widget.TextView; text: 4; contentDescription: null; checkable: false; checked: false; focusable: false; focused: false; selected: false; clickable: false; longClickable: false; enabled: true; password: false; scrollable: false; [ACTION_SELECT, ACTION_CLEAR_SELECTION, ACTION_ACCESSIBILITY_FOCUS, ACTION_NEXT_AT_MOVEMENT_GRANULARITY, ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY]]
We can see that one is clicking the right android.widget.Button and the second click its looking for android.widget.TextView.