Reputation: 157
I am new to automation. I am working on Android + Robot Framework + Appium. I am trying to get access to this 3 locators on the picture, but nothing seems to work.
As you can see, some of them even don't have an id or any other elements, so I guess I should use xpath to access them, but there is so many layers...
Could anyone please help me?
Upvotes: 1
Views: 2230
Reputation: 157
The main problem for me was to write a proper xpath, as I didn't know I should use classes for this.
So if I wanted to use classes and their indexes, the correct answer for third view is:
xpath=//android.view.View[@index='1']/android.widget.FrameLayout[@index='3']/android.view.View[@index='0']
And two previous paths are similar.
Upvotes: 3
Reputation: 381
You are using windows so, you can use UIAutomator available in android-sdk/tools to locate the elements. Here is an image of that tool
Upvotes: 2
Reputation: 32036
Not sure if you are using Appium Inspector only.
But you can certainly find the X-Path
to an element using it (image attached) :
Note : This is a random image from web just to depict the x-path is an attribute for elements inspected using Appium Inspector.
On the contrary to inspect elements within a WebView
for an application, I would suggest using
chrome://inspect/#devices
on your chrome browser.
Upvotes: 1