|
| 1 | +This is the list of main changes between major versions 7 and 8 of Appium |
| 2 | +java client. This list should help you to successfully migrate your |
| 3 | +existing automated tests codebase. |
| 4 | + |
| 5 | + |
| 6 | +## Strict W3C specification compatibility |
| 7 | + |
| 8 | +- Java client now supports Selenium 4, which also means it is |
| 9 | +*strictly* W3C compliant. Old JWP-based servers are not supported |
| 10 | +anymore, and it won't be possible to use the new client version |
| 11 | +with them. Capabilities that enforce the usage of JWP protocol |
| 12 | +on Appium drivers don't have any effect anymore. |
| 13 | +- The recommended way to provide capabilities for driver creation is |
| 14 | +to use specific option builders inherited from |
| 15 | +[BaseOptions class](https://github.com/appium/java-client/blob/master/src/main/java/io/appium/java_client/remote/options/BaseOptions.java). |
| 16 | +For example |
| 17 | +[XCUITestOptions](https://github.com/appium/java-client/blob/master/src/main/java/io/appium/java_client/ios/options/XCUITestOptions.java) |
| 18 | +to create a XCUITest driver instance or |
| 19 | +[UiAutomator2Options](https://github.com/appium/java-client/blob/master/src/main/java/io/appium/java_client/android/options/UiAutomator2Options.java) |
| 20 | +to create an UiAutomator2 driver instance. |
| 21 | +If there is no driver-specific options class for your driver then either use |
| 22 | +`BaseOptions` builder as the base class to define your capabilities or request |
| 23 | +driver developers to add one. _Do not_ use `DesiredCapabilities` class for this purpose in W3C context. |
| 24 | + |
| 25 | +## Elements lookup |
| 26 | + |
| 27 | +- All `findBy*` shortcut methods were removed. Consider using |
| 28 | +`findElement[s](By. or AppiumBy.)` instead. |
| 29 | +- `MobileBy` class has been deprecated. Consider using |
| 30 | +[AppiumBy](https://github.com/appium/java-client/blob/master/src/main/java/io/appium/java_client/AppiumBy.java) |
| 31 | +instead. |
| 32 | +- All locator names in `AppiumBy` have been aligned to follow the common |
| 33 | +(camelCase) naming strategy, e.g. `MobileBy.AccessibilityId` was changed |
| 34 | +to `AppiumBy.accessibilityId`. |
| 35 | +- The changes made in Selenium 4 broke `class name` selector strategy in Appium. |
| 36 | +`AppiumBy.className` should be used instead of Selenium's `By.className` now. |
| 37 | + |
| 38 | +## Time |
| 39 | + |
| 40 | +- All methods that use TimeUnit class or where the time is passed as |
| 41 | +a simple numeric value were replaced with their alternatives using |
| 42 | +[java.time.Duration](https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html) |
| 43 | +class. |
| 44 | + |
| 45 | +## Events |
| 46 | + |
| 47 | +- The current event firing mechanism that Appium java client uses |
| 48 | +has been deprecated in favour of the one that Selenium 4 provides |
| 49 | +natively. Read [The-event_firing.md](The-event_firing.md) for more |
| 50 | +details on how to use it. |
| 51 | + |
| 52 | +## AppiumDriver |
| 53 | + |
| 54 | +- All `AppiumDriver` descendants and the base class itself are not generic |
| 55 | +anymore and work with `WebElement` interface only. |
| 56 | +- The base Appium driver does not extend `ContextAware`, `Rotatable` and other |
| 57 | +mobile-specific interfaces. Instead, it only has the very basic set of methods. |
| 58 | +Mobile specific extensions have been respectively moved to `IOSDriver` and |
| 59 | +`AndroidDriver`. |
| 60 | +- Removed the obsolete `HasSessionDetails` extensions as it was using legacy |
| 61 | +JWP calls to retrieve session details. |
| 62 | +- `DefaultGenericMobileDriver` class has been removed. Now `AppiumDriver` is |
| 63 | +inherited directly from Selenium's `RemoteWebDriver`. |
| 64 | + |
| 65 | +## MobileElement |
| 66 | + |
| 67 | +- `DefaultGenericMobileElement` class has been removed completely together |
| 68 | +with its descendants (`MobileElement`, `IOSElement`, `AndroidElement` etc.). |
| 69 | +Use `WebElement` instead. |
| 70 | +- Due to the above change the page factory is now only creating elements |
| 71 | +that are instantiated from `RemoteWebElement` and implement `WebElement` interface. |
| 72 | +- If you used some special methods that `MobileElement` or its descendants provided |
| 73 | +then change these: |
| 74 | + - `replaceValue` has been moved to the corresponding `AndroidDriver` |
| 75 | + instance and is called now `replaceElementValue` |
| 76 | + - use `sendKeys` method of `WebElement` interface instead of `setValue`. |
| 77 | + |
| 78 | +## Touch Actions |
| 79 | + |
| 80 | +- The `TouchAction` and `MultiTouchAction` classes have been deprecated. |
| 81 | +The support of these actions will be removed from future Appium versions. |
| 82 | +Please use [W3C Actions](https://w3c.github.io/webdriver/#actions) instead |
| 83 | +or the corresponding extension methods for the driver (if available). |
| 84 | +Check |
| 85 | + - https://www.youtube.com/watch?v=oAJ7jwMNFVU |
| 86 | + - https://appiumpro.com/editions/30-ios-specific-touch-action-methods |
| 87 | + - https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/android-mobile-gestures.md |
| 88 | + - https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/ios/ios-xctest-mobile-gestures.md |
| 89 | + - https://appiumpro.com/editions/29-automating-complex-gestures-with-the-w3c-actions-api |
| 90 | +for more details on how to properly apply W3C Actions to your automation context. |
| 91 | + |
| 92 | +## resetApp/launchApp/closeApp |
| 93 | + |
| 94 | +- AppiumDriver methods `resetApp`, `launchApp` and `closeApp` have been deprecated as |
| 95 | +they are going to be removed from future Appium versions. Check |
| 96 | +https://github.com/appium/appium/issues/15807 for more details. |
0 commit comments