Changes in Capabilities Handling
Appium 2.0 introduces changes in how capabilities are handled. These changes are designed to align with industry standards and improve the overall user experience. Understanding these changes is crucial for harnessing the full potential of Appium 2.0.
Use of Vendor Prefixes
In Appium 2.0, users are required to include vendor prefixes in non-standard capability names. For example, if you wish to provide the device name in capabilities, it should consist of the vendor prefix “appium:deviceName.”
Examples of Defining Capabilities
Let’s explore examples of defining capabilities in Appium 2.0:
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/"), capabilities);
In the above code snippet, we define capabilities for an Android driver in Appium 2.0 using the UiAutomator2Options class. This approach ensures that capabilities are set correctly with the required vendor prefixes.