Appium Inspector with Kobiton remote devices

Appium Inspector with Kobiton remote devices

Roy Pham
Roy Pham

Overview

This blog post is gonna show you one of the hands-on experience that clearly demonstrates how to use Appium Inspector with a Kobiton remote device.
Appium Inspector helps you inspect and get all the details of UI elements of Mobile Applications. Based on it, you can create scripts for test automation.
ref: What is Appium Inspector?

The blog does not explain how to find the unique selectors (XPATH, CSS, …) for Mobile Applications. Instead, it focuses on connecting to a remote device and then do some functions supported by Appium Inspector.

And it is designed to work on Windows 10 Pro only, not on a macOS or Linux machine.

Before continuing, ensure you have installed the following tools

  1. Appium Desktop v1.21.0
    ref: download link
  2. Kobiton account
    During the steps, you will be required to connect with Kobiton Cloud providers. And ensure that your account has been granted with at least one remote device (either iPhone or Android device)
    01

Connect to a remote device

Follow the procedure below to connect to a remote iOS device and then open Safari browser on it

  1. Run Appium Desktop by clicking Start Server button
    02
    The server is running
    03
  2. Start Inspector Session by clicking Search icon
    04
    A new window opens up
  3. Select Cloud Providers
    05
  4. Select Kobiton icon and click Done
    06
  5. A new tab Kobiton appears
    07
  6. Click on the tab, fill Kobiton credentials
    08
    Kobiton Access Key is Default API key on Kobtion portal https://portal.kobiton.com/settings/keys/
    09
  7. Fill Desired Capabilities of the device and click Start Session
    10
  8. It may take serveral minutes (1-2 mins) to load the window completely
    Now you can do some actions (click, swipe, …) on the device which will go in detail in the next sections
    11
    The device Status will be changed from Online to Utilizing on Kobiton portal
    12
  9. When finished, click X button to exit the session
    13

Actions supported by Appium Inspector

There are some useful actions supported by Appium Inspector

  1. Go to URL on browser
    Click Actions tab
    Select Action Group: Web
    14
    Select Sub Group: Navigation
    Click Go to URL button
    15
    Fill the url https://www.google.com.vn/ and click Execute Action button
    16
    Wait until the page loading successfully in the left side
    17
    As an alternative, you can get the XPATH of the URL bar in NATIVE_APP context and then do Send Keys with the value https://www.google.com.vn/ to it.
  2. Switch Context (NATIVE_APP & WEBVIEW)
    You can get the current context of application under test using
    Action Group: Context
    Sub Group: Context
    Get Context
    It says the current context is WEBVIEW
    18

That’s reason why you can see some <div> tag (html element) in App source
19
You have some other options: Get All Context and Set Context
It says there are 2 contexts available when using Get All Context
20
And then you can switch context from WEBVIEW to NATIVE_APP using Set Context
21
The element will be changed in App Source when the current context is NATIVE_APP
You can get XPATH selector of URL bar, refresh button or any popup, …
22
4. Search element
You can use this function to check whether XPATH selector correct or not.
Note: Please switch back to WEBVIEW context in the following steps
Click Search icon
23
Select Locator Strategy: XPath
Fill Selector: //input[@name="q"]
Click Search button
24
There is one unique element found after searched
25
Click on the element for further actions (Tap, Send Keys, Clear, …)
5. Send Keys
Input some text: SHIFT ASIA
Click Send Keys
26
As you can see the text sent successfully on the search box
Click Done to close popup
27
6. Tap Element
Click Search icon
Select Locator Strategy: XPath
Fill Selector: (//span[text()="shift asia"])[1]
Click Search button
28
There is one unique element found after searched
Click on the element and then click Tap Element
29
Wait until the search result loading successfully
30
7. Swipe By Coordinates (Scroll UP/DOWN)
Click Swipe By Coordinates
31
If you want to scroll down to the bottom, you need to click one at the bottom first and then one at the top on the screen. It will simulate swiping action from bottom to top.
32
The page will scroll DOWN as expected
33
You would do the reverse when you want to scroll UP
8. Get Coordinate of Target Element
Sometimes you will need to click element at a certain coordinate (coordinate_X, coordinate_Y), this tool will help you to get them quickly by using Swipe button.
You just need to move the mouse hover on the target element, the coordinate will appear. And then you can use it for your scripts.
34


Controlling devices remotely just got easier with Appium Inspector.

That's all for the example, thanks for reading.

Enjoy it!