Appium Journey: The Leap from 1.x to 2.x

Nidhi R
6 min readMar 5, 2024

Appium is a powerful, open-source test automation tool that facilitates the testing of a wide range of applications, including native, hybrid, mobile web, and desktop apps. It has cross-platform capabilities to create and execute test scripts for different platforms such as iOS, Android, and desktop, all with a unified codebase. It also helps to improve the quality of mobile apps by ensuring that they are tested on a variety of devices and operating systems.

The Beta release of Appium 2.0 came out in 2021, and now Appium has officially rolled out version 2.0. It is a major release that introduces a number of new features and improvements. In this tutorial blog, I’ll guide you through the exciting features of Appium 2.0, showcasing the process of installation, configuration, and highlighting the significant changes introduced in this latest release.

Appium Installation

Before diving deep into Appium 2.x migration, let’s first ensure that you have the essential prerequisites and make sure to uninstall Appium 1.x before upgrading to Appium 2.x to avoid unexpected errors.

For Installation and Version verification, use the following commands one after the other in your command prompt or terminal:

npm i -g appium   #Install appium globally
appium -v #Check installed appium version

Breaking Changes

1. Drivers Installation:

  • In the previous Appium 1.x versions, whenever you installed Appium, it came with all the drivers pre-installed, all together. But things have evolved with Appium 2.x. When you install Appium 2, it installs just the Appium server but drivers are not included anymore. Now, drivers have their own separate installation and uninstallation process , thanks to the new Appium extension CLI. This means you can easily install/uninstall any specific version of drivers you want.
  • Command to install Android and iOS drivers using Appium extension CLI.
appium driver install uiautomator2  #Installs latest version of Android driver
appium driver install xcuitest #Installs latest version of IOS driver
  • To install a specific driver version, firstly uninstall any existing version (if present) then use the installation command with ‘@’ followed by the desired version number.
appium driver uninstall xcuitest       #Uninstalls existing IOS driver version
appium driver install xcuitest@4.11.1 #Installs mentioned version of IOS driver
  • Appium extension CLI offers a handy command that allows you to discover all available drivers and check which ones are currently installed / not-installed on your local system.
appium driver list #Lists all the available drivers
List of available drivers on my local system

2. Driver Updates:

  • As we already discussed, In the prior versions of Appium, all available drivers were bundled and installed alongside the Appium server. However, with Appium 2.x, you have more control over your drivers. Now, the Appium server and drivers are independently versioned and released allowing you to upgrade drivers as soon as their new version is out, rather than waiting for an entire Appium server release.
  • We can check the available updates for drivers using the following
    Appium Extension CLI command:
appium driver list --updates  #Lists the available updates for the drivers
uiautomator2, xcuitest and flutter drivers have new updates
  • If updates are available, you can update a specific driver or multiple drivers using commands shown below:
appium driver update xcuitest               #Updates specific driver
appium driver update uiautomator2,flutter #Updates multiple drivers

3. Appium Drivers Installation Path:

  • With the earlier versions of Appium, all installed drivers were stored in the “/path/to/appium/node_modules” directory. For example, if you were looking to manually build the WebDriverAgent, you’d find its location to be “/path/to/appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent”.
  • However, with Appium 2.x, things have gotten little more organized! Now, these drivers and dependencies are stored in a location defined by the “APPIUM_HOME” environment variable. By default, this path is set to “~/.appium”. So if you’re curious about where to find appium-webdriveragent after installing the XCUITest driver package, simply navigate to “~/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent” or, “$APPIUM_HOME/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent”.

4. Default Appium server base path:

Appium server launched at http://localhost:4723/
  • However, you can preserve the old behaviour by simply configuring the base path using ‘ — base-path’ command-line argument when launching the server.
appium --base-path=/wd/hub

5. Appium Desktop Deprecated:

  • In Appium version 1.x, there was a user-friendly Appium Desktop application used as a GUI application to start Appium Server and had a built-in Appium Inspector for mobile elements inspection.
  • However, in Appium 2.x, Appium Desktop is no longer supported. Instead, the Appium Inspector has become a separate desktop application that you can use to locate mobile elements. Additionally, Appium Inspector is available as a web application, which you can access through the browser by visiting the URL https://inspector.appiumpro.com/, just don’t forget to include the “ — allow-cors” flag when starting the Appium server on your local machine to connect the web Inspector to your local Appium Server session.
appium --allow-cors

6. Capabilities:

  • There’s a change in capabilities structure when we move from Appium 1.x to 2.x. What used to be known as “Desired Capabilities” is now simply called “Capabilities”. Now, we need to add vendor prefix to all non-standard capabilities which is different from standard ones listed in the WebDriver Protocol spec. So, what exactly is a vendor prefix? Well, it’s just a string followed by a colon, like appium:
    Here’s a list of few non-standard capabilities with vendor prefix:
{
"appium:deviceName": "<your_device_name>",
"appium:automationName": "UIAutomator2_or_XCUITest",
"appium:udid": "<your_device_udid>",
"appium:app": "<your_app_path>",
"appium:noReset": "<boolean>"
...
}
  • Appium has moved all its image-centric features like image comparison and locating elements by image into a dedicated plugin namedimages

7. Protocol Update:

Appium 1.x was based on the W3C WebDriver Protocol and it used to support older protocols (JSONWP, MJSONWP) as well so that older Selenium/Appium clients could still communicate with newer Appium servers. But going forward, Appium 2.x will only support and rely on W3C WebDriver Protocol, to standardise the communication.

8. Appium Plugin:

In appium 2.x, non-core features have been moved to special extensions called plugins which offer ways to extend or modify Appium’s behaviour. This provide users the flexibility to only integrate features that they genuinely need, saving them from unnecessary downloads and system configurations.
To get the list of plugins currently maintained by the Appium team, use the following command:

appium plugin list

Commands to install, uninstall and update appium plugin:

appium plugin install <plugin name>    #Installs specified plugin
appium plugin uninstall <plugin name> #Uninstalls specified plugin
appium plugin update <plugin name> #Updates specified plugin to its latest version

To use Appium Plugin and its functionalities, follow these two steps:

  1. Install the plugin: Use this command for plugin installation, ignore this step if it is already installed.
appium plugin install <plugin_name>

2. Add Plugin when launching Appium server: When you start the Appium server, make sure it can use the plugin. You can do this by adding it to the list of plugins when you run the following command -

appium --use-plugins=<plugin_name>

In the world of mobile app testing, Appium 2.x is a big upgrade. This handy tool now lets you manage drivers and capabilities more easily. You can also add extra features through plugins. The old Appium Desktop is gone, replaced by a separate Appium Inspector. These updates make testing mobile apps simpler and more flexible.

This blog mainly covered the server-side changes in Appium 2.x. Stay tuned for my next blog, where we will explore the migrations on the Appium Java Client side and discuss the code-level changes necessary for your mobile test automation suite.

--

--