Skip to content

Ensure selenium-manager downloaded chromedriver is used

Stan Hu requested to merge sh-fix-selenium-chromedriver into master

What does this MR do and why?

With https://github.com/SeleniumHQ/selenium/pull/12345 shipped in Selenium 4.12, the previous trick of inserting the chromedriver path downloaded by selenium-manager no longer works (introduced in !119141 (merged)).

Now, selenium-manager checks the PATH and finds the first chromedriver that it finds. Only if it cannot find a chromedriver in the PATH does selenium-manager attempt to check its cache for a downloaded version.

This commit updates the behavior by deleting any PATH entries that have a chromedriver executable. This allows an older chromedriver downloaded from Homebrew, for example, to co-exist.

How to set up and validate locally

  1. Install an older version of chromedriver in /opt/homebrew/bin (or somewhere in the PATH). Ensure which chromedriver returns that.
  2. On master, run bundle exec rspec spec/features/projects_spec.rb. You should see warnings about chromedriver warnings and errors due to incompatbility.
  3. On this branch, there should be no errors, and the spec should run.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Stan Hu

Merge request reports