testcontainers-java icon indicating copy to clipboard operation
testcontainers-java copied to clipboard

Changes to Selenium/WebDriver module for ongoing compatibility

Open rnorth opened this issue 4 years ago • 3 comments

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 -debug images are not required (and apparently not available for Firefox)
  • Remove provided scope dependencies, since we already require some Selenium JARs to be on the classpath. Gradle implementation scope 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 determineClasspathSeleniumVersion convenience 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

rnorth avatar Oct 29 '21 16:10 rnorth

Will fix https://github.com/testcontainers/testcontainers-java/issues/4593.

kiview avatar Dec 20 '21 11:12 kiview

Thank you @orange-buffalo - we really appreciate you taking the time to try this out and give us feedback.

rnorth avatar Jan 04 '22 09:01 rnorth

With #4914 being merged, this PR acts mostly as a reference for future refactorings and planned deprecations.

kiview avatar Jan 13 '22 10:01 kiview