This is the list of main changes between major versions 7 and 8 of Appium java client. This list should help you to successfully migrate your existing automated tests codebase.
- Java client now supports Selenium 4, which also means it is strictly W3C compliant. Old JWP-based servers are not supported anymore, and it won't be possible to use the new client version with them. Capabilities that enforce the usage of JWP protocol on Appium drivers don't have any effect anymore.
- The recommended way to provide capabilities for driver creation is
to use specific option builders inherited from
BaseOptions class.
For example
XCUITestOptions
to create a XCUITest driver instance or
UiAutomator2Options
to create an UiAutomator2 driver instance.
If there is no driver-specific options class for your driver then either use
BaseOptionsbuilder as the base class to define your capabilities or request driver developers to add one. Do not useDesiredCapabilitiesclass for this purpose in W3C context. Check unit tests for more examples on how to build driver options.
- All
findBy*shortcut methods were removed. Consider usingfindElement[s](By. or AppiumBy.)instead. MobileByclass has been deprecated. Consider using AppiumBy instead.- All locator names in
AppiumByhave been aligned to follow the common (camelCase) naming strategy, e.g.MobileBy.AccessibilityIdwas changed toAppiumBy.accessibilityId. - The changes made in Selenium 4 broke
class nameselector strategy in Appium.AppiumBy.classNameshould be used instead of Selenium'sBy.classNamenow.
- All methods that use TimeUnit class or where the time is passed as a simple numeric value were replaced with their alternatives using java.time.Duration class.
- The current event firing mechanism that Appium java client uses has been deprecated in favour of the one that Selenium 4 provides natively. Read The-event_firing.md for more details on how to use it.
- All
AppiumDriverdescendants and the base class itself are not generic anymore and work withWebElementinterface only. - The base Appium driver does not extend
ContextAware,Rotatableand other mobile-specific interfaces. Instead, it only has the very basic set of methods. Mobile specific extensions have been respectively moved toIOSDriverandAndroidDriver. - Removed the obsolete
HasSessionDetailsextensions as it was using legacy JWP calls to retrieve session details. DefaultGenericMobileDriverclass has been removed. NowAppiumDriveris inherited directly from Selenium'sRemoteWebDriver.
DefaultGenericMobileElementclass has been removed completely together with its descendants (MobileElement,IOSElement,AndroidElementetc.). UseWebElementinstead.- Due to the above change the page factory is now only creating elements
that are instantiated from
RemoteWebElementand implementWebElementinterface. - If you used some special methods that
MobileElementor its descendants provided then change these:replaceValuehas been moved to the correspondingAndroidDriverinstance and is called nowreplaceElementValue- use
sendKeysmethod ofWebElementinterface instead ofsetValue.
- The
TouchActionandMultiTouchActionclasses have been deprecated. The support of these actions will be removed from future Appium versions. Please use W3C Actions instead or the corresponding extension methods for the driver (if available). Check- https://www.youtube.com/watch?v=oAJ7jwMNFVU
- https://appiumpro.com/editions/30-ios-specific-touch-action-methods
- Android gesture shortcuts:
- iOS gesture shortcuts:
- https://appiumpro.com/editions/29-automating-complex-gestures-with-the-w3c-actions-api for more details on how to properly apply W3C Actions to your automation context.
- AppiumDriver methods
resetApp,launchAppandcloseApphave been deprecated as they are going to be removed from future Appium versions. Check appium/appium#15807 for more details.
- The default URL the server is listening on has been changed, and it
does not contain the
/wd/hubsuffix anymore (e.g.http://0.0.0.0:4723/wd/hubbecamehttp://0.0.0.0:4723/). This has been done in order to align the actual behavior with Appium v2. If you still would like to use v8 of the Java client with Appium v1.2x, where the server URL contains the/wd/hubsuffix by default, then consider providing--base-pathsetting explicitly while buildingAppiumServiceBuilderinstance (e.g..withArgument(GeneralServerFlag.BASEPATH, "/wd/hub/")). Older versions of Appium server (v1.19 and older) won't work withAppiumDriverLocalService, because they don't allow provisioning of base path in form of a command line argument.