Cannot locate any elements in this view

hi

Android - real device.
appium-dotnet-driver v2.0.0.1
c# / vs2015

I have the following using uiautomatorviewer

I am using the following command to locate the relative layout

ReadOnlyCollection linlayouts =
_driver.FindElementsByXPath(
//android.widget.LinearLayout[@resource-id=‘com.mobilaurus.supershuttle:id/content_container’]//android.widget.RelativeLayout”);

as i cannot seem to locate any element in this view, all other views previous and later all work using id’s and xpath’s fine, for some reason this particular view appium cannot locate any items/elements - i was using driver.tap but the co-ordinates are different on several devices so not practical

I have extended the timeout but appium applies the find request and never comes back…

Anyone got any ideas as to why this would be or is there a way to always find the button at the bottom of the screen for devices.

thanks in advance

Also is there a way to get at run-time the source of views rather than using uiautomatorviewer so you can actually view what elements are present

u can use findelementbyid and parameter:
BTW, in appium element location, Android resource-id means id. Have a try on this, and good luck.

try this
ReadOnlyCollection linlayouts =
_driver.FindElementsByXPath(
“//*android.widget.LinearLayout[@resource-id=“com.mobilaurus.supershuttle:id/content_container”]/child::*android.widget.RelativeLayout”);

or

ReadOnlyCollection linlayouts =
_driver.FindElementsByXPath(
“//[@class=“android.widget.LinearLayout”][@resource-id=“com.mobilaurus.supershuttle:id/content_container”]/child::[@class=“android.widget.RelativeLayout”]”);

hi

Tried the 1st one and it told me was invalid xpath/css selector. Tried the 2nd one and it does the same

appium output log viewer shows this

info: [debug] Waiting up to 30000ms for condition
info: [debug] Pushing command to appium work queue: [“find”,{“strategy”:“xpath”,“selector”:“//[@class=‘android.widget.LinearLayout’][@resource-id=‘com.mobilaurus.supershuttle:id/content_container’]/child::[@class=‘android.widget.RelativeLayout’]”,“context”:“”,“multiple”:true}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“xpath”,“selector”:“//[@class=‘android.widget.LinearLayout’][@resource-id=‘com.mobilaurus.supershuttle:id/content_container’]/child::[@class=‘android.widget.RelativeLayout’]”,“context”:“”,“multiple”:true}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding //[@class=‘android.widget.LinearLayout’][@resource-id=‘com.mobilaurus.supershuttle:id/content_container’]/child::[@class=‘android.widget.RelativeLayout’] using XPATH with the contextId: multiple: true

this is what i was getting before and even with the id locator as well. It is only this view that it does it on, other views i can use id locators etc and they work fine, for some reason this view just never returns anything. That’s why i initially reverted to driver.tap but that seems impractical. Too me it looks like it hits a loop in appium and never comes out.

hi

Tried this as this is what i had originally, comes back with element could not be located on the page using the given search parameters

output log in appium

info: [debug] Pushing command to appium work queue: [“find”,{“strategy”:“id”,“selector”:“com.mobilaurus.supershuttle:id/continue_button”,“context”:“”,“multiple”:false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“id”,“selector”:“com.mobilaurus.supershuttle:id/continue_button”,“context”:“”,“multiple”:false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding com.mobilaurus.supershuttle:id/continue_button using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.mobilaurus.supershuttle:id/continue_button]
info: [debug] [BOOTSTRAP] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
info: [debug] [BOOTSTRAP] [debug] Finding com.mobilaurus.supershuttle:id/continue_button using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.mobilaurus.supershuttle:id/continue_button]
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:7,“value”:“No element found”}
info: [debug] Condition unmet after 35369ms. Timing out.
info: [debug] Responding to client with error: {“status”:7,“value”:{“message”:“An element could not be located on the page using the given search parameters.”,“origValue”:“No element found”},“sessionId”:“4751fe75-a64c-42aa-a758-ca014941a95e”}
info: ← POST /wd/hub/session/4751fe75-a64c-42aa-a758-ca014941a95e/element 500 35374.388 ms - 195

please also refer to another reply lower down, ideally would like to get a snapshot of what appium actually sees for this view as it cannot find anything for some reason

just looked again at the layout, it wouldn’t be because the window-name is empty ?

disregard just looked at another view which works fine, that has window-name empty as well.

further check - tried using Appium Inspector all previous views load fine, image displayed and layout all shown, comes to this view and the inspector cannot load - always times out.

any more suggestions ?

Now have a further update on this, it seems to not work on my Samsung S6 device but works fine on a Galaxy Note when searching based on the element id.