appium-uiautomator2-server icon indicating copy to clipboard operation
appium-uiautomator2-server copied to clipboard

false negative when determine isVisibleToUser of an element

Open Kyle-Kyle opened this issue 8 years ago • 1 comments

When I'm doing some testing, I found the server gives me some log like this:

03-06 05:43:32.020 17429 17579 I appium  : Skipping invisible child: android.view.accessibility.AccessibilityNodeInfo@9c28; boundsInParent: Rect(400, 145 - 745, 205); boundsInScreen: Rect(800, 290 - 1490, 410); packageName: sworkitapp.sworkit.com; className: android.view.View; text: null; error: null; maxTextLength: -1; contentDescription:  通过Facebook登录 ; viewIdResName: null; checkable: false; checked: false; focusable: false; focused: false; selected: false; clickable: false; longClickable: false; contextClickable: false; enabled: true; password: false; scrollable: false; actions: [AccessibilityAction: ACTION_ACCESSIBILITY_FOCUS - null, AccessibilityAction: ACTION_NEXT_AT_MOVEMENT_GRANULARITY - null, AccessibilityAction: ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY - null, AccessibilityAction: ACTION_NEXT_HTML_ELEMENT - null, AccessibilityAction: ACTION_PREVIOUS_HTML_ELEMENT - null]

It says this element is not visible to user so it is skipped. However, this element is visible to user and I need to click it to do facebook login. Here is the screenshot of uiautomatorviewer screen shot 2018-03-06 at 7 40 41 pm

The code corresponding to this is

            AccessibilityNodeInfo child = node.getChild(i);
            if (child != null) {
                if (child.isVisibleToUser()) {
                    dumpNodeRec(child, serializer, i, width, height);
                    child.recycle();
                } else {
                    Logger.info(String.format("Skipping invisible child: %s", child.toString()));
                }
            } else {
                Logger.info(String.format("Null child %d/%d, parent: %s", i, count, node.toString()));
            }

in /app/src/main/java/io/appium/uiautomator2/core/AccessibilityNodeInfoDumper.java

I know this may be out of scope of what this project can handle to fix isVisibleToUser But I wonder whether we could make it configurable to judge whether to skip invisible children or not?

Kyle-Kyle avatar Mar 06 '18 11:03 Kyle-Kyle

boundsInParent: Rect(400, 145 - 745, 205); boundsInScreen: Rect(800, 290 - 1490, 410);

Looks like your device is in landscape mode.

vmaxim avatar Mar 06 '18 12:03 vmaxim