Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uiautomatorviewer - What does NAF stand for?

Its my understanding that UIAutomator is unable to automate any elements where NAF = true in uiautomatorviewer. Ive searched high and low but i cant for the life of me find what NAF stands for. Does anyone know?

like image 965
Tim Boland Avatar asked Aug 21 '14 21:08

Tim Boland


People also ask

What is the use of UIAutomator?

UI Automator is a framework suitable for cross-app functional UI testing across the installed apps. The APIs of UIAutomator lets you interact with visible elements on a device, regardless of which Android Activity is in focus.

What is UIAutomator viewer?

The uiautomatorviewer tool provides a convenient visual interface to inspect the layout hierarchy and view the properties of UI components that are visible on the foreground of the device.

What is UIAutomator in Appium?

UIAutomator 2 is an automation framework based on Android instrumentation and allows one to build and run UI tests. Appium uses Google's UIAutomator to execute commands on real devices and emulators. UIAutomator is Google's test framework for native app automation at the UI level.

Where is UI Automator viewer?

Open UIAutomatorViewer bat file in the Android installation folder with the following command: Android >> Android-SDK >> Tools >> UIAutomatorViewer.


1 Answers

"Not Accessibility Friendly"

These are UI elements which are apparently interactive, but which don't have accessibility affordances like content descriptions.

From the source for AccessibilityNodeInfoDumper.java (part of 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);
}
like image 132
blahdiblah Avatar answered Oct 13 '22 03:10

blahdiblah