A painless guide to install Appium and Appium Inspector on Linux
Prerequisites
- A Linux operating system installed box
- Node.js and npm (Node Package Manager)
Install npm
Follow the official instructions here.
# installs nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# download and install Node.js (you may need to restart the terminal)
nvm install 20
# verifies the right Node.js version is in the environment
node -v # should print `v20.15.1`
# verifies the right NPM version is in the environment
npm -v # should print `10.7.0`
Install Appium
Open a terminal window and run the following command to install Appium globally using npm
$ npm install --location=global appium
Run the following command to test if appium is working
$ appium --help
usage: appium [-h] [-v]
{setup,server,driver,plugin} ...
A webdriver-compatible server that facilitates
automation of web, mobile, and other types of apps
across various platforms.
positional arguments:
{setup,server,driver,plugin}
setup Select a preset of
official drivers/plugins
to install compatible with
'Linux' host platform.
Existing drivers/plugins
will remain. The default
preset is 'mobile'.
server Run an Appium server
driver Access the driver
management CLI commands
plugin Access the plugin
management CLI commands
optional arguments:
-h, --help show this help message and
exit
-v, --version show program's version
number and exit
Install UiAutomator2 Driver
Run the following command
$ appium driver install uiautomator2
Check if uiautomator is installed
$ appium driver list
✔ Listing available drivers
- uiautomator2@3.7.2 [installed (npm)]
- xcuitest [not installed]
- espresso [not installed]
- mac2 [not installed]
- windows [not installed]
- safari [not installed]
- gecko [not installed]
- chromium [not installed]
Install Appium Inspector
Appium Inspector is a graphical tool for inspecting mobile applications, interacting with UI elements, generating UI object paths and codes during automation.
Download AppImage:
- Visit the Appium Inspector releases page on GitHub: https://github.com/appium/appium-inspector/releases
- Download the
.AppImage
file compatible with your Linux system (32-bit or 64-bit).
Make AppImage Executable:
Open a terminal window in the downloaded AppImage file
$ chmod a+x Appium-Inspector-linux-<version>.AppImage
Run AppImage
$ ./Appium-Inspector-linux-<version>.AppImage
Download SDK Platform Tools for Linux
Download SDK Platform Tools
Untar the download and keep it in your preferable path. Set up the environment variable ANDROID_SDK_ROOT
to point to the extraction directory. add the following line to .bashrc
$ export ANDROID_SDK_ROOT=/path/to/platform-tools
Run Appium and Appimage in two seperate sessions
Save Capability
Add and save the following capability to the Appium-Inspector for inspecting an Android app UI interactions like a web browser inspection
{
"platformName": "Android",
"appium:automationName": "uiautomator2"
}
Finally open an emulator, connect it with the PC with adb and start a session to interact with the app to automate.