Skip to main content

Quality Assurance

Harness The Power of Appium Inspector

Female It Specialist

As we learned in the last blog, how to set up Appium 2.0 from scratch and install Appium Inspector too. This blog will teach about Appium Inspector’s desired capabilities to start our Android apps. Appium Inspector is part of the Appium 2.0 framework used to inspect elements within mobile applications for automation testing. Appium Inspector enables users to identify elements such as text boxes, buttons, drop-downs, etc., by getting their attributes like ID, class, and paths.

Capabilities of Appium

  • appium:platformName – This capability is used to call Appium to automate testing on the specified platform. It specifies the platform name. For example, if you are testing an Android application, then set platformName to “Android”; if you are testing an iOS application, you set platformName to “IOS”.
  • appium:platformVersion – It specifies the version of the mobile operating system running on the device. For example, if you are testing an Android application on a device running Android 10 then, set platformVersion to “10”. Similarly, if you are testing an iOS application on a device running iOS 14, you set platformVersion to “12.0”.
  • appium:automationName – Which driver is used to automate the application.For Android, “UiAutomator2” and “Espresso” for native apps, and “XCUITest” for iOS.
  • appium:deviceName – It is used to specify the name of the mobile devices or emulator. This capability allows Appium to identify the target device.
  • appium:appPackage – It launches a particular application from your mobile device.
  • appium:appActivity – It launches a particular activity within the Android application. It is used for navigating to the initial screen where your test case is started.

How to Set Capabilities in Appium Inspector

  • Open the Android Studio and Appium Inspector installed on your system in our previous blog Appium 2.0.
  • Create and open Emulator under Android Studio.
  • Start the Appium server by entering the command ‘appium’ on Git bash Terminal.
    appium 
    
    [Appium] Welcome to Appium v2.0.1 [Appium] Attempting to load driver uiautomator2... [debug] 
    [Appium] Requiring driver at C:\Users\ASUS\.appium\node_modules\appium-uiautomator2-driver 
    [Appium] Appium REST http interface listener started on http://0.0.0.0:4723 [Appium] You can provide the following URLS in your client code to connect to this server: [Appium] http://192.168.1.3:4723/ [Appium] http://127.0.0.1:4723/ (only accessible from the same host)
  • To check your Android device or emulator is up and running, use the command ‘adb devices’.
    $ adb devices
    List of devices attached
    emulator-5554   device
    
  • Download a sample native APK app for testing from apk native app
  • Then drag and drop the downloaded apk app file to your emulator.
    Apk File
  • Click and open your downloaded apk app under your emulator.

Set Capabilities under Appium Inspector

  • By default, our appium runs on ‘http://127.0.0.1:4723/’; we need to set ‘Remote Host: 127.0.0.1’ and “Remote Port: 4723”.
    Remote Host
  • Set desired capabilities appium:platformName, if you are testing an Android application then, set platformName to “Android”; if you are testing an iOS application, you set platformName to “IOS”. Then click on ‘+’.
    Platformname
  • Set desired capabilities appium:platformVersion, to check your platform version by using the command ‘adb shell getprop ro.build.version.release’.
    $ adb shell getprop ro.build.version.release
    14

    Platformversion

  • Set desired capabilities appium:automationName, Which driver is used to automate the application. For Android, “UIAutomator2” and “XCUITest” are for iOS.
    Autoname
  • Set Capabilities appium:deviceName, To check your Android device name, use the command ‘adb devices’.
    $ adb devices
    List of devices attached
    emulator-5554   device

    Device Name

  • Set capabilities appium:appPackage and appium:appActivity, to check your app package and app activity details, we need to open apk app on your device or emulator and then, enter the command in git bash terminal ‘adb shell dumpsys window displays | grep mFocusedApp’.
    Apppackege
    Appactivity
  • Let’s close apk app on your device or emulator, then click on the ‘Start Session’ button under Appium Inspector.
    App Open

         See, our APK app is successfully up and running.

  • You can see locators such as XPath, class name, and accessibility of apk app home screen with the source code. We can use that xpath class name to automate our Android scripts.

Conclusion:

This blog should help users set up desired capabilities under Appium Inspector to launch Android apps. We can find locators (xpaths, ID, class name) and it is easier to locate app components such as textbox, button, dropdown, etc. You can select individual elements in the app by clicking on them by inspector. It is part of the Appium 2.0 framework to inspect elements within mobile applications for automation testing. In the next blog, we will create one project and automate apk app.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Saurabh Dev

Saurabh Dev is a Technical Consultant at Perficient. He has 3 Years of Experience in Software Development and Test Engineer. Saurabh is also willing to learn different types of tools, Frameworks and learn about new technologies.

More from this Author

Follow Us