Java Code Examples for androidx.test.uiautomator.UiDevice#findObject()

The following examples show how to use androidx.test.uiautomator.UiDevice#findObject() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ComplexUiActionHandler.java    From android-uiconductor with Apache License 2.0 4 votes vote down vote up
public static void zoom(Point startPoint1, Point startPoint2, Point endPoint1, Point endPoint2) {
  UiDevice uiDevice = UiDevice.getInstance(getInstrumentation());
  UiObject uiObject = uiDevice.findObject(new UiSelector());
  uiObject.performTwoPointerGesture(startPoint1, startPoint2, endPoint1, endPoint2, ZOOM_STEPS);
}
 
Example 2
Source File: AndroidTestsUtility.java    From line-sdk-android with Apache License 2.0 4 votes vote down vote up
public static boolean checkTextExists(String text) {
    UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
    UiObject result = uiDevice.findObject(new UiSelector().text(text));
    return result.exists();
}
 
Example 3
Source File: AndroidTestsUtility.java    From line-sdk-android with Apache License 2.0 4 votes vote down vote up
public static boolean checkElementExists(String className) {
    UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
    uiDevice.wait(Until.hasObject(By.clazz(className)), AndroidTestsConfig.TIMEOUT);
    UiObject2 element = uiDevice.findObject(By.clazz(className));
    return element.isEnabled() && element.isClickable() && element.isFocusable();
}
 
Example 4
Source File: PermissionActivityTest.java    From RxPermission with Apache License 2.0 4 votes vote down vote up
private static UiObject getButton(final String text) {
  final UiDevice device = UiDevice.getInstance(getInstrumentation());
  return device.findObject(new UiSelector().text(text));
}
 
Example 5
Source File: UiObjectMatcher.java    From device-automator with MIT License 4 votes vote down vote up
public UiObject getUiObject(UiDevice device) {
    return device.findObject(getUiSelector());
}