Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rust] Fallback for chromedriver versions in Selenium Manager (#11383) #11454

Merged
merged 1 commit into from
Jan 7, 2023

Conversation

bonigarcia
Copy link
Member

Description

This PR implements a fallback mechanism (max 5 retries) when reading the versions of chromedriver. For instance:

> cargo run -- --browser chrome --browser-version dev
    Finished dev [unoptimized + debuginfo] target(s) in 0.19s
     Running `target\debug\selenium-manager.exe --browser chrome --browser-version dev`
WARN    Error getting version of chromedriver 110. Retrying with chromedriver 109 (attempt 1/5)
INFO    C:\Users\boni\.cache\selenium\chromedriver\win32\109.0.5414.25\chromedriver.exe
> cargo run -- --browser chrome --browser-version canary
    Finished dev [unoptimized + debuginfo] target(s) in 0.20s
     Running `target\debug\selenium-manager.exe --browser chrome --browser-version canary`
WARN    Error getting version of chromedriver 111. Retrying with chromedriver 110 (attempt 1/5)
WARN    Error getting version of chromedriver 110. Retrying with chromedriver 109 (attempt 2/5)
INFO    C:\Users\boni\.cache\selenium\chromedriver\win32\109.0.5414.25\chromedriver.exe

Motivation and Context

This PR solves #11383.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@titusfortner
Copy link
Member

Hmm, I think there should just be one or two fallbacks instead of 5? The specific problem at hand is that it looks like Chrome only releases drivers for production and beta, and not for dev and canary, so we should use the beta version of the driver for dev, and theoretically we figure out how to get the most recent nightly build of the driver for Canary. Microsoft makes everything much easier for Edge, and this isn't an issue for Firefox or Safari.

@bonigarcia
Copy link
Member Author

@titusfortner Having a retries count of 5 for this logic is not too much, IMO.
See, for example, the provided example for the canary version. In that case, the proper driver version is achieved on the third attempt since the browser version was 111, but chromedriver 111 is not published (first try), nor chromedriver 110 (second try), and the latest published version is 109 (third and final try, in that case).

All in all, the minimum retries number should be three. And having a guard of two more tries, just in case, does not hurt, IMO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants