当前位置: 首页>>代码示例>>Java>>正文


Java BySelector.clazz方法代码示例

本文整理汇总了Java中android.support.test.uiautomator.BySelector.clazz方法的典型用法代码示例。如果您正苦于以下问题:Java BySelector.clazz方法的具体用法?Java BySelector.clazz怎么用?Java BySelector.clazz使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.test.uiautomator.BySelector的用法示例。


在下文中一共展示了BySelector.clazz方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: withTextStartingWith

import android.support.test.uiautomator.BySelector; //导入方法依赖的package包/类
/**
 * Find a view based on the prefixed text in the view. The matching is case-insensitive.
 *
 * @param text Prefix to search for.
 * @param klass Expected class of the view.
 * @return
 */
public static UiObjectMatcher withTextStartingWith(String text, Class klass) {
    UiSelector uiSelector = new UiSelector()
            .textStartsWith(text);
    BySelector bySelector = By.textStartsWith(text);

    if (klass != null) {
        uiSelector = uiSelector.className(klass);
        bySelector.clazz(klass);
    }

    return new UiObjectMatcher(uiSelector, bySelector);
}
 
开发者ID:lkorth,项目名称:device-automator,代码行数:20,代码来源:UiObjectMatcher.java

示例2: withTextContaining

import android.support.test.uiautomator.BySelector; //导入方法依赖的package包/类
/**
 * Find a view based on the text contained within the view. The matching is case-sensitive.
 *
 * @param text Text to search for inside a view.
 * @param klass Expected class of the view.
 * @return
 */
public static UiObjectMatcher withTextContaining(String text, Class klass) {
    UiSelector uiSelector = new UiSelector()
            .textContains(text);
    BySelector bySelector = By.textContains(text);

    if (klass != null) {
        uiSelector = uiSelector.className(klass);
        bySelector.clazz(klass);
    }

    return new UiObjectMatcher(uiSelector, bySelector);
}
 
开发者ID:lkorth,项目名称:device-automator,代码行数:20,代码来源:UiObjectMatcher.java

示例3: withText

import android.support.test.uiautomator.BySelector; //导入方法依赖的package包/类
/**
 * Find a view based on the exact text contained within the view. Matching is case-insensitive.
 *
 * @param text Exact text in the view.
 * @param klass Expected class of the view.
 * @return
 */
public static UiObjectMatcher withText(String text, Class klass) {
    Pattern pattern = Pattern.compile("(?i)" + Pattern.quote(text));

    UiSelector uiSelector = new UiSelector()
            .textMatches(pattern.pattern());
    BySelector bySelector = By.text(pattern);

    if (klass != null) {
        uiSelector = uiSelector.className(klass);
        bySelector.clazz(klass);
    }

    return new UiObjectMatcher(uiSelector, bySelector);
}
 
开发者ID:lkorth,项目名称:device-automator,代码行数:22,代码来源:UiObjectMatcher.java

示例4: withResourceId

import android.support.test.uiautomator.BySelector; //导入方法依赖的package包/类
/**
 * Find a view based on the resource id. Resource ids should be the fully qualified id,
 * ex: com.android.browser:id/url
 *
 * @param id The fully qualified id of the view, ex: com.android.browser:id/url
 * @param klass Expected class of the view.
 * @return
 */
public static UiObjectMatcher withResourceId(String id, Class klass) {
    UiSelector uiSelector = new UiSelector()
            .resourceId(id);
    BySelector bySelector = By.res(id);

    if (klass != null) {
        uiSelector = uiSelector.className(klass);
        bySelector.clazz(klass);
    }

    return new UiObjectMatcher(uiSelector, bySelector);
}
 
开发者ID:lkorth,项目名称:device-automator,代码行数:21,代码来源:UiObjectMatcher.java

示例5: withContentDescription

import android.support.test.uiautomator.BySelector; //导入方法依赖的package包/类
/**
 * Find a view based on the content description of the view. The content-description is typically used by the
 * Android Accessibility framework to provide an audio prompt for the widget when the widget is selected.
 * The content-description for the widget must match exactly with the string in your input argument.
 * Matching is case-sensitive.
 *
 * On {@link android.os.Build.VERSION_CODES#LOLLIPOP} devices and higher than matcher can be
 * used to match views in {@link android.webkit.WebView}s and browsers.
 *
 * @param text Content description of the view.
 * @param klass Expected class of the view.
 * @return
 */
public static UiObjectMatcher withContentDescription(String text, Class klass) {
    UiSelector uiSelector = new UiSelector()
            .description(text);
    BySelector bySelector = By.desc(text);

    if (klass != null) {
        uiSelector = uiSelector.className(klass);
        bySelector.clazz(klass);
    }

    return new UiObjectMatcher(uiSelector, bySelector);
}
 
开发者ID:lkorth,项目名称:device-automator,代码行数:26,代码来源:UiObjectMatcher.java


注:本文中的android.support.test.uiautomator.BySelector.clazz方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。