Skip to content

[🐛 Bug]: Can't Fetch the Driver Path #13876

@pgundlupetvenkatesh

Description

@pgundlupetvenkatesh

What happened?

I am trying to get to Driver path so I can fetch driver version and by running below code throws undefined method 'driver_path' for Class:Class error

options = Selenium::WebDriver::Options.chrome(browser_version: 'stable')
finder = Selenium::WebDriver::DriverFinder.new(options, Selenium::WebDriver::Chrome::Service)
puts "Driver path: #{finder.driver_path}"

I am referring the above code from https://github.com/SeleniumHQ/seleniumhq.github.io/blob/trunk/examples/ruby/spec/drivers/service_spec.rb#L34

Specs:
Ruby v3.2.1
Watir v7.3
Selenium-webdriver v4.20.0

How can we reproduce the issue?

options = Selenium::WebDriver::Options.chrome(browser_version: 'stable')
path = Selenium::WebDriver::DriverFinder.new(options, Selenium::WebDriver::Chrome::Service)
puts "Driver path: #{path.driver_path}"

Relevant log output

2024-04-25 12:43:34 DEBUG Selenium [:selenium_manager] Selenium Manager binary found at <ruby_path>/selenium-webdriver-4.20.0/bin/windows/selenium-manager.exe
2024-04-25 12:43:34 DEBUG Selenium [:selenium_manager] Executing Process ["<ruby_path>/selenium-webdriver-4.20.0/bin/windows/selenium-manager.exe", "--browser", "chrome", "--browser-version", "stable", "--language-binding", "ruby", "--output", "json", "--debug"]
2024-04-25 12:43:35 DEBUG Selenium [:selenium_manager] chromedriver not found in PATH
2024-04-25 12:43:35 DEBUG Selenium [:selenium_manager] chrome detected at <chrome_path>\chrome.exe
2024-04-25 12:43:35 DEBUG Selenium [:selenium_manager] Running command: wmic datafile where name='<chrome_path>\\chrome.exe' get Version /value
2024-04-25 12:43:35 DEBUG Selenium [:selenium_manager] Output: "\r\r\n\r\r\nVersion=124.0.6367.78\r\r\n\r\r\n\r\r\n\r"
2024-04-25 12:43:35 DEBUG Selenium [:selenium_manager] Detected browser: chrome 124.0.6367.78
2024-04-25 12:43:35 DEBUG Selenium [:selenium_manager] Discovered online chrome version (124) is the same as the detected local chrome version
2024-04-25 12:43:35 DEBUG Selenium [:selenium_manager] Required driver: chromedriver 124.0.6367.78
2024-04-25 12:43:35 DEBUG Selenium [:selenium_manager] chromedriver 124.0.6367.78 already in the cache
2024-04-25 12:43:35 DEBUG Selenium [:selenium_manager] Driver path: <user_home>\.cache\selenium\chromedriver\win64\124.0.6367.78\chromedriver.exe
2024-04-25 12:43:35 DEBUG Selenium [:selenium_manager] Browser path: <chrome_path>\Google\Chrome\Application\chrome.exe
2024-04-25 12:43:35 DEBUG Selenium [:driver_service] Executing Process ["<user_home>\\.cache\\selenium\\chromedriver\\win64\\124.0.6367.78\\chromedriver.exe", "--port=9515"]
2024-04-25 12:43:35 DEBUG Selenium [:process] Starting process: ["<user_home>\\.cache\\selenium\\chromedriver\\win64\\124.0.6367.78\\chromedriver.exe", "--port=9515"] with {[:out, :err]=>#<IO:<STDERR>>}
2024-04-25 12:43:35 DEBUG Selenium [:process]   -> pid: 10100
Starting ChromeDriver 124.0.6367.78 (a087f2dd364ddd58b9c016ef1bf563d2bc138711-refs/branch-heads/6367@{#954}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
2024-04-25 12:43:36 DEBUG Selenium [:command] -> POST session
2024-04-25 12:43:36 DEBUG Selenium [:command]    >>> http://127.0.0.1:9515/session | {"capabilities":{"alwaysMatch":{"browserName":"chrome","platformName":"windows","pageLoadStrategy":"eager","unhandledPromptBehavior":"ignore","goog:chromeOptions":{"args":["--ignore-certificate-errors","--start-maximized","--disable-extensions"],"binary":"<path>\\Google\\Chrome\\Application\\chrome.exe","prefs":{"download":{"prompt_for_download":false,"default_directory":"<path>\\cucumber-watir\\downloads"},"credentials_enable_service":false,"password_manager_enabled":false},"excludeSwitches":["enable-logging","enable-automation"]}}}}
2024-04-25 12:43:36 DEBUG Selenium [:header]      > {"Accept"=>"application/json", "Content-Type"=>"application/json; charset=UTF-8", "User-Agent"=>"selenium/4.20.0 (ruby windows)", "Content-Length"=>"558"}
2024-04-25 12:43:38 DEBUG Selenium [:header]    <<<  {"content-length"=>["874"], "content-type"=>["application/json; charset=utf-8"], "cache-control"=>["no-cache"]}
2024-04-25 12:43:38 DEBUG Selenium [:command] <- {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"124.0.6367.78","chrome":{"chromedriverVersion":"124.0.6367.78 (a087f2dd364ddd58b9c016ef1bf563d2bc138711-refs/branch-heads/6367@{#954})","userDataDir":"<user_home>\\AppData\\Local\\Temp\\2\\scoped_dir10100_1412998568"},"fedcm:accounts":true,"goog:chromeOptions":{"debuggerAddress":"localhost:59403"},"networkConnectionEnabled":false,"pageLoadStrategy":"eager","platformName":"windows","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"ignore","webauthn:extension:credBlob":true,"webauthn:extension:largeBlob":true,"webauthn:extension:minPinLength":true,"webauthn:extension:prf":true,"webauthn:virtualAuthenticators":true},"sessionId":"f73bc4b945d9692eed3e9a8cf5be729a"}}
2024-04-25 12:43:38 ERROR Selenium Exception occurred: undefined method `driver_path' for Class:Class
2024-04-25 12:43:38 ERROR Selenium Backtrace:
        <ruby_path>/selenium-webdriver-4.20.0/lib/selenium/webdriver/common/driver_finder.rb:44:in `paths'
        <ruby_path>/selenium-webdriver-4.20.0/lib/selenium/webdriver/common/driver_finder.rb:33:in `driver_path'
      Unable to obtain ; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location (Selenium::WebDriver::Error::NoSuchDriverError)

Operating System

Windows 10

Selenium version

4.20.0

What are the browser(s) and version(s) where you see this issue?

Chrome v124, Edge v124

What are the browser driver(s) and version(s) where you see this issue?

ChromeDriver 124.0.6367.78

Are you using Selenium Grid?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-rbRuby BindingsI-defectSomething is not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions