1

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. screenshot from UI Automator Viewer

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?

Anna
  • 147
  • 1
  • 1
  • 13

3 Answers3

3

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.

Anna
  • 147
  • 1
  • 1
  • 13
2

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 enter image description here

saurabh-ar
  • 381
  • 1
  • 4
  • 17
1

Not sure if you are using Appium Inspector only.

But you can certainly find the X-Path to an element using it (image attached) :

Some sample image from web

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.

Naman
  • 27,789
  • 26
  • 218
  • 353
  • But I work on Windows and my Appium Inspector looks like this: http://appium.io/slate/images/windows-inspector.png – Anna Jun 08 '16 at 14:17
  • This Chrome Inspect for Devices looks great, but I stuck here: i.imgur.com/slmCp0y.png as I work on a Genymotion Emulator. And I probably don't have USB driver installed... – Anna Jun 08 '16 at 15:10