The most recent iteration of the Appium mobile automation framework is Appium 2. This edition includes numerous enhancements, new features, and improved performance. This tutorial will guide you through upgrading from Appium 1.x to Appium 2.x, stressing the advantages and providing code samples to illustrate them.
Unlike Appium 1, Appium 2 does not have built-in support for iOS and Android. Instead, to enable the essential features for your automated tests, you must now install the necessary drivers (as well as optional plugins).
What has changed with Appium 2?
For Appium 1, you must use http://localhost:4723/wd/hub in your tests. With Appium 2, the new URL is http://localhost:4723/, therefore the wd/hub portion is no longer necessary.
You can use this command to continue using the Appium 1 URL if you so choose:
Modifications to Protocol
The W3C WebDriver protocol and MJSONWP (Mobile JSON Wire Protocol) were both supported by Appium 1.x. Appium 2.x onwards only supports the W3C WebDriver protocol.
Driver Installation Required
All drivers were installed as soon as you downloaded and installed Appium 1. With Appium 2, this is no longer the case; for your automated tests to function, you must now install the required drivers. These are a few of the most well-liked drivers:
UIAutomator2 Driver for Android testing. To install, use this command: appium driver install uiautomator2
XCUITest Driver for iOS testing. To install, use this command: appium driver install xcuitest
Capabilities in Appium 2
Before Appium 2, you may designate any set of capabilities. The only names that can be given without a vendor prefix since Appium 2 are browserName and platformName. Every other capability must come before a string and a colon, such as tb: or appium:
appium: app
appium: deviceName
Image Comparison Changes
Appium 1 supported various image comparison commands. Since Appium 2, this feature has been moved to an Appium Plugin.
Plugins are components that can be added to Appium 2 and offer additional features. To install the image comparison library (used for visual testing), you can use this command with Appium 2.x:
Appium Desktop is now called Appium Inspector
The inspector features of Appium Desktop have been divided into a new program named Appium Inspector. This new application can run on later Appium 1. x servers and is entirely compatible with standalone Appium 2.x servers. It’s crucial to remember that Appium Desktop 2.x is incompatible with it and has been deprecated.
What Does an example Appium 2.x Test Look Like?
An Appium 2 test looks very similar to an Appium 1 test, with the necessary changes required.
Switching from Appium 1.x to Appium 2.x introduces many new features and performance gains. Some of the significant modifications require explicit driver installations and improved capability labeling. Appium Plugins now contain functionality such as image comparison. Writing tests remain unchanged despite these modifications. Compatibility requires renaming Appium Desktop to Appium Inspector. Generally, this guidance seeks to ease the transition and guarantee that testers can efficiently optimize workflows for mobile automation.
Source: Read MoreÂ