Skip to content

Conversation

bonigarcia
Copy link
Member

@bonigarcia bonigarcia commented Mar 15, 2023

Description

As reported in #11745, currently Selenium Manager returns several lines when chromedriver is installed through npm. This PR includes some logic to filter these lines by selecting only the first of the executables files (if available).

The following output has been generated in Windows and Linux respectively, in both cases with chromedriver installed with npm:

C:\Users\boni\Documents\dev\selenium\rust>cargo run -- --browser chrome --debug
    Finished dev [unoptimized + debuginfo] target(s) in 0.22s
     Running `target\debug\selenium-manager.exe --browser chrome --debug`
DEBUG   Using shell command to find out chrome version
DEBUG   Running command: "wmic datafile where name='%PROGRAMFILES:\\=\\\\%\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe' get Version /value"
DEBUG   Output: "\r\r\n\r\r\nVersion=111.0.5563.65\r\r\n\r\r\n\r\r\n\r"
DEBUG   The version of chrome is 111.0.5563.65
DEBUG   Detected browser: chrome 111
DEBUG   Required driver: chromedriver 111.0.5563.64
DEBUG   Running command: "chromedriver --version"
DEBUG   Output: "ChromeDriver 111.0.5563.64 (c710e93d5b63b7095afe8c2c17df34408078439d-refs/branch-heads/5563@{#995})"
DEBUG   Running command: "where chromedriver"
DEBUG   Output: "C:\\Users\\boni\\AppData\\Roaming\\npm\\chromedriver\r\nC:\\Users\\boni\\AppData\\Roaming\\npm\\chromedriver.cmd"
DEBUG   Found chromedriver 111.0.5563.64 in PATH: C:\Users\boni\AppData\Roaming\npm\chromedriver.cmd
INFO    C:\Users\boni\AppData\Roaming\npm\chromedriver.cmd

NOTE: I also tested that chromedriver.cmd can be used as a driver in a Selenium test.

boni@slimbook:~/dev/selenium/rust$ cargo run -- --browser chrome --debug
    Finished dev [unoptimized + debuginfo] target(s) in 0.11s
     Running `target/debug/selenium-manager --browser chrome --debug`
DEBUG	Using shell command to find out chrome version
DEBUG	Running command: "google-chrome --version"
DEBUG	Output: "Google Chrome 111.0.5563.64 "
DEBUG	The version of chrome is 111.0.5563.64
DEBUG	Detected browser: chrome 111
DEBUG	Reading chromedriver version from https://chromedriver.storage.googleapis.com/LATEST_RELEASE_111
DEBUG	Required driver: chromedriver 111.0.5563.64
DEBUG	Running command: "chromedriver --version"
DEBUG	Output: "ChromeDriver 111.0.5563.64 (c710e93d5b63b7095afe8c2c17df34408078439d-refs/branch-heads/5563@{#995})"
DEBUG	Running command: "which chromedriver"
DEBUG	Output: "/usr/local/bin/chromedriver"
DEBUG	Found chromedriver 111.0.5563.64 in PATH: /usr/local/bin/chromedriver
INFO	/usr/local/bin/chromedriver

Motivation and Context

This PR fixes #11745.

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.

@bonigarcia bonigarcia added the C-rust Rust code is mostly Selenium Manager label Mar 15, 2023
@bonigarcia bonigarcia merged commit 4cb9093 into trunk Mar 16, 2023
@bonigarcia bonigarcia deleted the se_mgr_filter_path branch March 16, 2023 09:06
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.

[🐛 Bug]: selenium-manager returns multiple lines when chromedriver has been installed through npm
2 participants