feat!: replace selenium-remote-driver, selenium-http and selenium-json - #2462
mykola-mokhnach wants to merge 3 commits into
Conversation
91eebd3 to
4875121
Compare
I haven't looked into the code, but Appium's base-driver does support endpoints relating to several of these features.
They are actually served: https://appium.io/docs/en/latest/reference/api/others/#selenium-protocol |
AppiumDriver now extends AppiumRemoteWebDriver, which sends commands through AppiumCommandExecutor, the W3C codecs, the handshake and the HTTP client that are maintained in this project. They are adapted from the Selenium 4.50.0 remote driver, which becomes the minimum supported selenium-api version. The Selenium remote layer, its HTTP client and JSON library are no longer dependencies, and neither are Guava, OpenTelemetry and selenium-manager that came with them. The runtime classpath is selenium-api, gson, byte-buddy, slf4j-api and jspecify. The new code consists of: - an HTTP/WebSocket transport (io.appium.java_client.http) with a default java.net.http implementation; - a Gson-based JSON layer that keeps the selenium-json number semantics; - the command and response types, W3C codecs, handshake and error mapping; - AppiumRemoteWebDriver and AppiumWebElement. Golden files recorded on Selenium 4.50.0 pin the requests the drivers send, the values they return and the exceptions they throw. Replayed against the new stack they are unchanged, apart from the dropped commands, the exception classes owned by java-client and a clearer error for an empty error body. A test against a local HTTP server covers the default HTTP client, the headers and the error mapping end to end. Set GOLDEN_UPDATE=1 to regenerate them. Browser-only features are dropped: virtual authenticators, FedCM, downloads, shadow DOM, web storage, file upload, DevTools and tracing. BiDi support is removed from the driver and moves to a separate module. BREAKING CHANGE: java-client requires selenium-api 4.50.0 or newer. AppiumDriver is not a RemoteWebDriver anymore and returns AppiumWebElement instead of RemoteWebElement. Response, Command, SessionId, CommandPayload, DriverCommand, ExecuteMethod and the error types moved to io.appium.java_client.remote, and org.openqa.selenium.remote.http is replaced by io.appium.java_client.http, including the HttpClient.Factory parameter of the driver constructors. AppiumClientConfig, AppiumCommandExecutor, AppiumW3CHttpCommandCodec and ErrorCodesMobile no longer extend Selenium classes, the constructors taking a Selenium ClientConfig are removed, and HasBiDi, getBiDi and maybeGetBiDi are removed from AppiumDriver. See docs/v10-to-v11-migration-guide.md. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
4875121 to
2188bc8
Compare
Appium's base driver routes these W3C and extension endpoints (and proxies them to chromedriver in web contexts), so dropping them removed working features. AppiumRemoteWebDriver implements HasVirtualAuthenticator and HasFederatedCredentialManagement again, AppiumWebElement#getShadowRoot is back, and the commands are defined in DriverCommand and the W3C codec, ported from Selenium 4.50.0. Their encoding is identical to the Selenium recording, and driver scenarios cover the three features. The /se/log routes used by manage().logs() are served by Appium too, so the migration guide no longer lists them as unsupported. Still dropped because Appium does not route them: downloads, file upload, web storage, DevTools and tracing. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
You're right, thanks. I checked the base-driver routes: shadow DOM (
Also right. The Still dropped, because base-driver doesn't route them: downloads ( |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
It's not clear to me which exact endpoints for web storage, DevTools and tracing are being dropped here, if they even are endpoints. |
You're right, only some of these are endpoints. The dropped ones that are:
These are Selenium Grid routes that base-driver doesn't serve. The rest are not endpoints:
It isn't affected. |
Summary
Stage 4b of cutting java-client's dependency on Selenium down to
selenium-api. This replacesselenium-remote-driver,selenium-httpandselenium-json(andselenium-os, whose last use went away with #2460) with code maintained in this repo. Guava, OpenTelemetry andselenium-managerno longer come in transitively either.Runtime classpath after this PR:
selenium-api,gson,byte-buddy(now declared explicitly),slf4j-api,jspecify.The minimum supported Selenium version is now 4.50.0. The vendored code is adapted from that release.
What changed
io.appium.java_client.http: transport SPI (HttpClient,HttpClient.Factory, requests/responses, filters, WebSocket) with a defaultjava.net.httpimplementation. Self-contained, guarded by checkstyle import control.internal.json.WireJson: Gson-based wire JSON. Integers and whole numbers are read asLong, others asDouble, and values are written like Selenium'sJsondoes for the types Appium sends.remote:Command,Response,SessionId,DriverCommand,ErrorCodes/ErrorHandler, W3C codecs, a W3C-only handshake, a standaloneAppiumCommandExecutor, and theAppiumRemoteWebDriver/AppiumWebElementbase classes.AppiumClientConfigis standalone and implementshttp.ClientConfig.GET/POST/DELETE /session/:id/se/files(downloads),POST /session/:id/se/file(file upload) andPOST /session/:id/se/event(session events). Also dropped are the Selenium-side web storage commands (JavaScript sent to/execute/sync, deprecated in Selenium), DevTools over these:cdpWebSocket and OpenTelemetry tracing; none of these are Appium endpoints.POST /session/:id/goog/cdp/execute(ExecuteCDPCommand) is kept./se/log.AppiumDriver. Selenium deprecatedHasBiDi#getBiDifor removal and reworked the API (getHandle()doesn't exist in older releases), so it moves to a separate bridge module in a follow-up. The URL stays available in thewebSocketUrlcapability.Small fixes found on the way:
AppiumClientConfig#withFilterdropped the Appium user-agent and idempotency filters.wsTimeoutwas reset to the default when other settings changed.driver.close()threw an NPE when the server returned no value.How it was verified
Commits are ordered so the behavior is pinned before it is replaced:
DriverCommandandMobileCommand, JSON serialization, response decoding (incl. number types), W3C error mapping, ~100 driver API calls, session creation failures and direct connect.AppiumDriverOverHttpTestruns the full stack against a real local HTTP server (headers, HTTP/1.1, JSON, error mapping, connection failure).Unit tests: 188 run, the same 3 environment-only failures as on master (
TimeoutTest,StorageTest,DesktopBrowserCompatibilityTest). Checkstyle, Javadoc and compilation of all e2e source sets are clean.Breaking changes
See
docs/v10-to-v11-migration-guide.md. In short:BREAKING CHANGE: Minimum
selenium-apiis 4.50.0.selenium-support,-remote-driverand the other modules are no longer dependencies, so declare them yourself if you use them.BREAKING CHANGE:
AppiumDriveris no longer aRemoteWebDriverand returnsAppiumWebElementinstead ofRemoteWebElement. Code typed againstWebDriver/WebElementis unaffected.BREAKING CHANGE:
Response,Command,CommandPayload,SessionId,DriverCommand,ExecuteMethodand the error types moved toio.appium.java_client.remote.CommandInfois replaced byAppiumCommandInfo.BREAKING CHANGE:
org.openqa.selenium.remote.httpis replaced byio.appium.java_client.http, including theHttpClient.Factoryparameter of the driver constructors. Constructors taking a SeleniumClientConfigare removed.BREAKING CHANGE:
AppiumClientConfig,AppiumCommandExecutor,AppiumW3CHttpCommandCodecandErrorCodesMobileno longer extend Selenium classes.BREAKING CHANGE:
HasBiDi,getBiDi()andmaybeGetBiDi()are removed fromAppiumDriver. The two BiDi e2e tests are removed until the bridge module exists.Known issues / follow-ups
🤖 Generated with Claude Code