Changes to Selenium/WebDriver module for ongoing compatibility
Co-authored with @kiview and @GannaChernyshova, this PR started out with some minor (hacky) workarounds but evolved into a rethink of what features are sensible for us to keep on trying to make work given:
- existence of Selenium 4.0.0, with some breaking API changes
- some mutable tags being used for Selenium Docker images, and the (IMHO correct) recommendations by the Selenium team that more exactly pinnable tags should be used in our use case.
Very WIP - all of this could change. It may be that we're being too opinionated in deprecation of some of our more opinionated features..!
Primary changes:
-
Selenium 4.0.0 compatibility fixes
- Remove in-code workaround for Chrome GPU issue, which created coupling to a Selenium 3.x API
- Remove support for Selenium 2.x, as supporting 3 major versions of the library becomes infeasible
- Use non-debug docker images automatically for Selenium 4.x, as
-debugimages are not required (and apparently not available for Firefox)
-
Remove
providedscope dependencies, since we already require some Selenium JARs to be on the classpath. Gradleimplementationscope is used despite Selenium classes being in our API - this is a slight and deliberate abuse, but seems better than us potentially forcing an upgrade of Selenium by updating our dependency version. -
Steps to phase out implicit docker image detection and to remove API methods that are coupled to Selenium classes
- Deprecate constructors that do not supply a user-pinnable Docker image
- Deprecate constructors/methods that involve Capabilities and RemoteWebDriver
- Suggest alternative approaches for obtaining a WebDriver instance, predicated on future removal of APIs that are coupled to Selenium classes
- Have not deprecated the
determineClasspathSeleniumVersionconvenience method that can be used to identify Selenium version on the classpath, as this may be something that users want to use
-
Steps to follow up on in future PR
- TODO: plenty of docs, examples and migration notes
- TODO: specific documentation around best-practices for selecting a pinnable Selenium image
- TODO: phase out implicit use of Chrome
Will fix https://github.com/testcontainers/testcontainers-java/issues/4593.
Thank you @orange-buffalo - we really appreciate you taking the time to try this out and give us feedback.
With #4914 being merged, this PR acts mostly as a reference for future refactorings and planned deprecations.