1. Appium 2 Installation
npm i -g appium@next
2. Driver Installation
From Appium 2.0 drivers can be installed/uninstalled or updated independently. For example,
if an update is available for XCUITest then rather than waiting for a new Appium server
release we can update the driver only by using CLI commands.
Install IOS Driver in Appium 2:
appium driver install xcuitest
Install Android Driver in Appium 2:
appium driver install uiautomator2
How to Update Driver:
appium driver update xcuitest
Update Multiple drivers :
appium driver update xcuitest,uiautomator2
How to check all available/Installed drivers
appium driver list
3. Capabilities In Appium 2.0
Now User needs to include the vendor prefix in the non-standard capabilities names.
For Example, if you wish to provide deviceName in capabilities, it should consist of the
vendor prefix “appium:deviceName“.
Appium 1 (Older way):
Earlier in the Appium 1. x version we used to define capabilities using DesiredCapabilities
class to set various properties and preferences that define how an automation session should be
established with a mobile device or an emulator.
DesiredCapabilities androidCaps = new DesiredCapabilities();
androidCaps.setCapability("deviceName", "Pixel XL API 30");
androidCaps.setCapability("automationName", "UIAutomator2");
androidCaps.setCapability("udid", "emulator-5554");
androidCaps.setCapability("platformName", "Android");
androidCaps.setCapability("app",System.getProperty("user.dir") + "/src/test/resources/files/Bilgikolik.apk");
androidCaps.setCapability("appPackage", "com.testapp.app");
androidCaps.setCapability("appActivity", "com.testapp.app");
driver = new AndroidDriver(newURL("http://127.0.0.1:4723"),androidCaps);
Appium 2 Capabilities
In Appium 2, we use UiAutomator2Options class that provides information to Appium about
the desired configuration for the test session. Refer below code.
UiAutomator2Options capabilities = new UiAutomator2Options();
capabilities.setPlatformName("Android").setAutomationName("UIAutomator2")
.setAppPackage("Package Name").setAppActivity("Activity Name")
.setApp("App Path");
AndroidDriver driver = new AndroidDriver(new URL("http://0.0.0.0:4723/"),c
4. Appium Inspector
Appium 2.0 segregated Appium Inspector from Appium Desktop. Also, the Appium team provided
the browser version of the Appium inspector. To test against local servers, you’ll need to
start the server with --allow-cors so that the browser-based version of Appium Inspector can
access the Appium server to start sessions.
5. Changes In Drivers and Classes
SelendroidDriver class is removed.
MobileElement classes including AndroidElement and iOSElement classes are removed. It is recommended
to use WebElement.
@AndroidFindBy(xpath ="//android.widget.TextView[@text='Continue']")
private WebElement Continue;
Mobile By Class has been removed, and AppiumBy Class has been introduced.
Older Way:
driver.findElement(MobileBy.id("loginbutton")).click();
New Way:
driver.findElement(AppiumBy.id("loginbutton")).click();
All locator names in AppiumBy have been aligned to follow the camelCase naming strategy,
e.g. MobileBy.AccessibilityId was changed to AppiumBy.accessibilityId.
Appium Driver is directly inherited from Selenium’s RemoteWebDriver. There is no intermediate
layer between AppiumDriver and RemoteWebDriver.
ResetApp, launch apps, and closeApp methods have been depreciated.
Appium Inspector is split out from Appium Desktop. Appium Inspector can be used with its web
version without downloading anything.
6. TouchAction/MultiTouchAction
From Appium 2.0 both TouchAction and MultiTouchAction class has been depreciated.W3c Action
API will be used for automating gestures. For Example, the double Click Gesture can be achieved using the below code:
driver.executeScript("mobile: doubleClickGesture", ImmutableMap.of(
"elementId", ((RemoteWebElement) element).getId());
Reference Link Click here