Skip to content

[rust] Use drivers found in PATH only when browser version is not specified#13159

Merged
titusfortner merged 1 commit intotrunkfrom
sm_browser_version
Nov 16, 2023
Merged

[rust] Use drivers found in PATH only when browser version is not specified#13159
titusfortner merged 1 commit intotrunkfrom
sm_browser_version

Conversation

@bonigarcia
Copy link
Copy Markdown
Member

Description

This PR changes the internal driver resolution algorithm of Selenium Manager to honor browser-version even when a driver in PATH is found. Some examples:

Invalid chromedriver in PATH and browser-version is not specified

./selenium-manager --debug --browser chrome
DEBUG   Found chromedriver 107.0.5304.62 in PATH: C:\Users\boni\Documents\bat\chromedriver.exe
DEBUG   chrome detected at C:\Program Files\Google\Chrome\Application\chrome.exe
DEBUG   Running command: wmic datafile where name='C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe' get Version /value
DEBUG   Output: "\r\r\n\r\r\nVersion=119.0.6045.124\r\r\n\r\r\n\r\r\n\r"
DEBUG   Detected browser: chrome 119.0.6045.124
DEBUG   Required driver: chromedriver 119.0.6045.105
WARN    The chromedriver version (107.0.5304.62) detected in PATH at C:\Users\boni\Documents\bat\chromedriver.exe might not be compatible with the detected chrome version (119.0.6045.124); currently, chromedriver 119.0.6045.105 is recommended for chrome 119.*, so it is advised to delete the driver in PATH and retry
INFO    Driver path: C:\Users\boni\Documents\bat\chromedriver.exe
INFO    Browser path: C:\Program Files\Google\Chrome\Application\chrome.exe

Invalid chromedriver in PATH but browser-version is specified

./selenium-manager --debug --browser chrome --browser-version stable
DEBUG   Found chromedriver 107.0.5304.62 in PATH: C:\Users\boni\Documents\bat\chromedriver.exe
DEBUG   chrome detected at C:\Program Files\Google\Chrome\Application\chrome.exe
DEBUG   Running command: wmic datafile where name='C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe' get Version /value
DEBUG   Output: "\r\r\n\r\r\nVersion=119.0.6045.124\r\r\n\r\r\n\r\r\n\r"
DEBUG   Detected browser: chrome 119.0.6045.124
DEBUG   Discovered online chrome version (119) is the same as the detected local chrome version
DEBUG   Required driver: chromedriver 119.0.6045.105
DEBUG   chromedriver 119.0.6045.105 already in the cache
INFO    Driver path: C:\Users\boni\.cache\selenium\chromedriver\win64\119.0.6045.105\chromedriver.exe
INFO    Browser path: C:\Program Files\Google\Chrome\Application\chrome.exe

Motivation and Context

This PR implements #13128.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-rust Rust code is mostly Selenium Manager

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants