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
BaseOptions
builder as the base class to define your capabilities or request driver developers to add one. Do not useDesiredCapabilities
class 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. MobileBy
class has been deprecated. Consider using AppiumBy instead.- All locator names in
AppiumBy
have been aligned to follow the common (camelCase) naming strategy, e.g.MobileBy.AccessibilityId
was changed toAppiumBy.accessibilityId
. - The changes made in Selenium 4 broke
class name
selector strategy in Appium.AppiumBy.className
should be used instead of Selenium'sBy.className
now.
- 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
AppiumDriver
descendants and the base class itself are not generic anymore and work withWebElement
interface only. - The base Appium driver does not extend
ContextAware
,Rotatable
and other mobile-specific interfaces. Instead, it only has the very basic set of methods. Mobile specific extensions have been respectively moved toIOSDriver
andAndroidDriver
. - Removed the obsolete
HasSessionDetails
extensions as it was using legacy JWP calls to retrieve session details. DefaultGenericMobileDriver
class has been removed. NowAppiumDriver
is inherited directly from Selenium'sRemoteWebDriver
.
DefaultGenericMobileElement
class has been removed completely together with its descendants (MobileElement
,IOSElement
,AndroidElement
etc.). UseWebElement
instead.- Due to the above change the page factory is now only creating elements
that are instantiated from
RemoteWebElement
and implementWebElement
interface. - If you used some special methods that
MobileElement
or its descendants provided then change these:replaceValue
has been moved to the correspondingAndroidDriver
instance and is called nowreplaceElementValue
- use
sendKeys
method ofWebElement
interface instead ofsetValue
.
- The
TouchAction
andMultiTouchAction
classes 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
,launchApp
andcloseApp
have 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/hub
suffix anymore (e.g.http://0.0.0.0:4723/wd/hub
becamehttp://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/hub
suffix by default, then consider providing--base-path
setting explicitly while buildingAppiumServiceBuilder
instance (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.