Location attribute in Android occasionally / randomly incorrect

Has anyone else experienced random errors where Appium returns an incorrect Location attribute for an element? Just inquiring before I physically log a bug in Git. I’ve provided a small snippet of the relevant data below.

Appium Server 1.4.16
Python 2.7.10
Appium-Python-Client 0.20
Mac OSX 10.10.5
Nexus 6 phone running Android 5.1

GENERIC XPATH OF TABLE ROW USED TO LOCATE EACH AND EVERY ROW OF DYNAMIC DATA IN THE TABLE:

 //android.widget.TextView[@resource-id="com.cisco.swtg_android:id/tv_case_number"]

SPECIFIC ELEMENT XML FROM PAGE SOURCE AT TIME OF WRONG LOCATION VALUE:

<android.widget.TextView index="1" text="9999999" class="android.widget.TextView"        package="com.cisco.swtg_android" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[298,456][514,513]" resource-id="com.cisco.swtg_android:id/tv_case_number" instance="5"/>

APPIUM SERVER LOG SNIPPET BASED ON ATTRIBUTE DISCOVERY AGAINST THIS ELEMENT:

36minfoe[39m: [debug] Pushing command to appium work queue: ["element:getSize",{"elementId":"209"}]
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:getSize","params":{"elementId":"209"}}
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command action: getSize
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":{"width":216,"height":57}}
e[36minfoe[39m: [debug] Responding to client with success: {"status":0,"value":{"width":216,"height":57},"sessionId":"c851f071-61fc-4396-86dd-5c3dc09b8467"}
e[36minfoe[39m: e[37m<-- GET /wd/hub/session/c851f071-61fc-4396-86dd-5c3dc09b8467/element/209/size e[39me[32m200e[39me[90m 39.784 ms - 97e[39m e[90m{"status":0,"value":{"width":216,"height":57},"sessionId":"c851f071-61fc-4396-86dd-5c3dc09b8467"}e[39m
e[36minfoe[39m: e[37m-->e[39m e[37mGETe[39m e[37m/wd/hub/session/c851f071-61fc-4396-86dd-5c3dc09b8467/element/209/locatione[39m e[90m{}e[39m
e[36minfoe[39m: [debug] Pushing command to appium work queue: ["element:getLocation",{"elementId":"209"}]
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:getLocation","params":{"elementId":"209"}}
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command action: getLocation
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":{"x":298,"y":2140}}
e[36minfoe[39m: [debug] Responding to client with success: {"status":0,"value":{"x":298,"y":2140},"sessionId":"c851f071-61fc-4396-86dd-5c3dc09b8467"}
e[36minfoe[39m: e[37m<-- GET /wd/hub/session/c851f071-61fc-4396-86dd-5c3dc09b8467/element/209/location e[39me[32m200e[39me[90m 41.823 ms - 90e[39m e[90m{"status":0,"value":{"x":298,"y":2140},"sessionId":"c851f071-61fc-4396-86dd-5c3dc09b8467"}e[39m
e[36minfoe[39m: e[37m-->e[39m e[37mGETe[39m e[37m/wd/hub/session/c851f071-61fc-4396-86dd-5c3dc09b8467/element/209/attribute/texte[39m e[90m{}e[39m
e[36minfoe[39m: [debug] Pushing command to appium work queue: ["element:getAttribute",{"elementId":"209","attribute":"text"}]
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:getAttribute","params":{"elementId":"209","attribute":"text"}}
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command action: getAttribute
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"9999999"}

Observe it returned a location of {“x”:298,“y”:2140} for my element. However, not only is the element in question not at this location (element is first row in table, location returned is somewhere near the bottom), there is no element at all in the entire page source XML returned by Appium that has the location of {“x”:298,“y”:2140} Thus I’m confused.

Hmmmm, here’s a relevant snippet of data from adb logcat and this appears to be where the location data is coming from:

I/QueryController( 5699): Matched selector: UiSelector[CLASS=android.widget.TextView, INSTANCE=5, COUNT=5] <<==>> [android.view.accessibility.AccessibilityNodeInfo@8004ada6; boundsInParent: Rect(0, 0 - 216, 57); boundsInScreen: Rect(298, 2140 - 514, 2197); packageName: com.cisco.swtg_android; className: android.widget.TextView; text: 9999999; error: null; maxTextLength: -1; contentDescription: null; viewIdResName: com.cisco.swtg_android:id/tv_case_number; checkable: false; checked: false; focusable: false; focused: false; selected: false; clickable: false; longClickable: false; enabled: true; password: false; scrollable: false; actions: [AccessibilityAction: ACTION_SELECT - null, AccessibilityAction: ACTION_CLEAR_SELECTION - null, AccessibilityAction: ACTION_ACCESSIBILITY_FOCUS - null, AccessibilityAction: ACTION_NEXT_AT_MOVEMENT_GRANULARITY - null, AccessibilityAction: ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY - null, AccessibilityAction: ACTION_SET_SELECTION - null]]

Did you manage to understand what’s happening, or send an issue to Git? I’m facing the same issue