use of android.support.test.uiautomator.UiSelector in project platform_frameworks_base by android.
the class UiBot method findDownloadRetryDialog.
public UiObject findDownloadRetryDialog() {
UiSelector selector = new UiSelector().text("Couldn't download");
UiObject title = mDevice.findObject(selector);
title.waitForExists(mTimeout);
return title;
}
use of android.support.test.uiautomator.UiSelector in project platform_frameworks_base by android.
the class DirectoryListBot method findDocument.
public UiObject findDocument(String label) throws UiObjectNotFoundException {
final UiSelector docList = new UiSelector().resourceId("com.android.documentsui:id/container_directory").childSelector(new UiSelector().resourceId(DIR_LIST_ID));
// Wait for the first list item to appear
new UiObject(docList.childSelector(new UiSelector())).waitForExists(mTimeout);
// new UiScrollable(docList).scrollIntoView(new UiSelector().text(label));
return mDevice.findObject(docList.childSelector(new UiSelector().text(label)));
}
use of android.support.test.uiautomator.UiSelector in project android by nextcloud.
the class InitialTest method clickByText.
/**
* Helper to click on object that match the text value.
*
* @param text the text
* @throws UiObjectNotFoundException
*/
private void clickByText(String text) throws UiObjectNotFoundException {
UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
UiObject obj = device.findObject(new UiSelector().text(text));
obj.clickAndWaitForNewWindow();
}
use of android.support.test.uiautomator.UiSelector in project android_frameworks_base by crdroidandroid.
the class RootsListBot method findRoot.
private UiObject findRoot(String label) throws UiObjectNotFoundException {
final UiSelector rootsList = new UiSelector().resourceId("com.android.documentsui:id/container_roots").childSelector(new UiSelector().resourceId(ROOTS_LIST_ID));
// We might need to expand drawer if not visible
if (!new UiObject(rootsList).waitForExists(mTimeout)) {
Log.d(TAG, "Failed to find roots list; trying to expand");
final UiSelector hamburger = new UiSelector().resourceId("com.android.documentsui:id/toolbar").childSelector(new UiSelector().className("android.widget.ImageButton").clickable(true));
new UiObject(hamburger).click();
}
// Wait for the first list item to appear
new UiObject(rootsList.childSelector(new UiSelector())).waitForExists(mTimeout);
// Now scroll around to find our item
new UiScrollable(rootsList).scrollIntoView(new UiSelector().text(label));
return new UiObject(rootsList.childSelector(new UiSelector().text(label)));
}
use of android.support.test.uiautomator.UiSelector in project android_frameworks_base by crdroidandroid.
the class UiBot method getVisibleObject.
/**
* Gets an object which is guaranteed to be present in the current UI.
*
* @param text Object's text as displayed by the UI.
*/
public UiObject getVisibleObject(String text) {
UiObject uiObject = mDevice.findObject(new UiSelector().text(text));
assertTrue("could not find object with text '" + text + "'", uiObject.exists());
return uiObject;
}
Aggregations