Java Code Examples for android.support.test.uiautomator.By#desc()

The following examples show how to use android.support.test.uiautomator.By#desc() . 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: ElementController.java    From UIAutomatorWD with MIT License 6 votes vote down vote up
private static BySelector getSelector(String strategy, String text) throws Exception {
    BySelector selector = null;
    switch (strategy) {
        case "CLASS_NAME":
            selector = By.clazz(text);
            break;
        case "NAME":
            selector = By.desc(text);
            if(selector == null || elements.getmDevice().findObject(selector) == null){
                selector = By.text(text);
            }
            break;
        case "ID":
            selector = By.res(text);
            break;
        case "TEXT_CONTAINS":
            selector = By.textContains(text);
            break;
        case "DESC_CONTAINS":
            selector = By.descContains(text);
            break;
    }
    return selector;
}