We’ll be continuing the topic we discussed on our last Appium blog post on finding UI elements and this is the 17th blog in our series of Things You Should Know About Appium. This time we’ll be focusing on Selendroid and how UI element identification works with it. Just like Appium and uiautomator, Selendroid also comes with a useful inspector tool – Selendroid Inspector – which we will also take a look at in this post. And obviously, this applies only to Android.

Despite Selendroid being used as one option for Appium, there are lots of great features that you can utilize in your test script creation, test execution and generally in your test automation process:

Full compatibility with the JSON Wire Protocol

App under test requires no modifications or tweaks (due to nature of instrumentation)

Mobile web testing is also possible, even as an embedded in Android app (WebView app)

UI elements can be found with varying locators

The concept works the same for native and hybrid apps

In an advanced framework, gestures and other not-just-click interactions are fully supported

It was done for both emulators and real devices from the beginning, so even a large set of devices works fine with Selendroid

Quick and handy tool – Selendroid Inspector

How to Start Standalone Selendroid?

Selendroid can be executed also as a standalone. In order to get standalone Selendroid up and running, you need to first start the Selendroid-standalone component and then client driver can be instantiated.

As you can see, the same attribute of an element may need to use a different find_element convention. Also, Selendroid does not support resource-id attributes at all, since they were introduced on Android version 4.3 (API 18). When automating a test via Selendroid, you will need to use other element types instead.

What Is and How to Use Selendroid Inspector

It’s pretty similar to Appium Inspector and uiautomatorviewer but Selendroid also has its own inspection tool called Selendroid Inspector. Basically It’s a web app which is embedded inside Selendroid test server. Its purpose is to let you inspect the current state of your app’s UI and find elements of your app the same way as with uiautomatorviewer. If you are interested to learn more about these tools for test script generation take a look at this blog post.

Here is how to get it up and running when you have started Selendroid-standalone:

1) Start a test session.

2) Open your web browsers and navigate to http://localhost:4444/inspector.

3) That’s it! You can view the hierarchy of your app, view standalone UI elements and their properties, record clicks and some other actions, display and view the HTML source of any web view, and also use its XPath helper to get the specific XPath.

We’ll be covering XPath more in details in our upcoming blogs.

Happy Testing and stay tuned for more details in best practices with Appium and how to build yet better tests with it!