android-uiautomator - uiautomatorviewer - NAF 代表什么?

标签 android-uiautomator

我的理解是 UIAutomator 无法自动化 uiautomatorviewer 中 NAF = true 的任何元素。我已经搜索了高低,但我一生都无法找到 NAF 代表什么。有人知道吗?

最佳答案

" 无障碍友好 "

这些 UI 元素显然是交互式的,但没有像内容描述这样的可访问性可供性。

来自 AccessibilityNodeInfoDumper.java 的来源(uiautomator 的一部分):

/**
 * We're looking for UI controls that are enabled, clickable but have no
 * text nor content-description. Such controls configuration indicate an
 * interactive control is present in the UI and is most likely not
 * accessibility friendly. We refer to such controls here as NAF controls
 * (Not Accessibility Friendly)
 *
 * @param node
 * @return false if a node fails the check, true if all is OK
 */
private static boolean nafCheck(AccessibilityNodeInfo node) {
    boolean isNaf = node.isClickable() && node.isEnabled()
            && safeCharSeqToString(node.getContentDescription()).isEmpty()
            && safeCharSeqToString(node.getText()).isEmpty();
    if (!isNaf)
        return true;
    // check children since sometimes the containing element is clickable
    // and NAF but a child's text or description is available. Will assume
    // such layout as fine.
    return childNafCheck(node);
}

关于android-uiautomator - uiautomatorviewer - NAF 代表什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25435878/

相关文章:

android - Dexguard 发布 apk 不显示 UI automator 中元素的资源 ID

Android Uiautomator 无法以编程方式识别 View ID

android - UIAutomator 可以远程使用吗?

java - junit.framework.AssertionFailedError : Back button can't be pressed

avd - UI Automator Viewer : receiving "Error taking device screenshot: null" every time from AVD device

javascript - 如何检查当前文件是否是javascript中的主文件(iOS Instruments UI Automator)

python - NoSuchElementException 与 uiautomator2

Android 无法运行 UI 测试,并显示 "uiautomator: permission denied"错误消息

java - 错误 : Target id is not valid.

java - 在 Android 应用程序上定位元素时出现 InvalidSelectorException