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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃悰 Bug]: Unable to obtain browser driver #12456

Closed
Pauan opened this issue Aug 1, 2023 · 14 comments
Closed

[馃悰 Bug]: Unable to obtain browser driver #12456

Pauan opened this issue Aug 1, 2023 · 14 comments

Comments

@Pauan
Copy link

Pauan commented Aug 1, 2023

What happened?

I followed the directions to install selenium-webdriver through npm.

Then I copy-pasted the JavaScript code on the "Write your first Selenium script" page.

However, when I tried to run that code, I got an "Unable to obtain browser driver" error. The relevant page said to file a bug report.

How can we reproduce the issue?

Here is a Gist that contains the code:

https://gist.github.com/Pauan/d22b69c5e6fad00a1806ce1d9cafe7f0

Relevant log output

[INFO] Searching for WebDriver executables installed on the current system...
/tmp/selenium/node_modules/selenium-webdriver/common/driverFinder.js:35
    throw Error(
    ^

Error: Unable to obtain browser driver.
        For more information on how to install drivers see
        https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location/. TypeError: options.getBrowserName is not a function
    at getPath (/tmp/selenium/node_modules/selenium-webdriver/common/driverFinder.js:35:11)
    at getAvailableBrowsers (/tmp/selenium/node_modules/selenium-webdriver/testing/index.js:121:6)
    at init (/tmp/selenium/node_modules/selenium-webdriver/testing/index.js:225:59)
    at suite (/tmp/selenium/node_modules/selenium-webdriver/testing/index.js:375:5)
    at Object.<anonymous> (/tmp/selenium/test.js:10:1)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)

Node.js v18.16.0

Operating System

NixOS Unstable 64-bit

Selenium version

npm 4.11.0

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

N/A

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

N/A

Are you using Selenium Grid?

N/A

@github-actions
Copy link

github-actions bot commented Aug 1, 2023

@Pauan, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@titusfortner
Copy link
Member

I'm seeing this in our documentation repo as well. https://github.com/SeleniumHQ/seleniumhq.github.io/actions/runs/5719915294/job/15498812127

@diemol
Copy link
Member

diemol commented Aug 1, 2023

This was fixed in 4.11.1 thanks to @harsha509!
https://www.npmjs.com/package/selenium-webdriver/v/4.11.1

@diemol diemol closed this as completed Aug 1, 2023
@Pauan
Copy link
Author

Pauan commented Aug 1, 2023

@diemol Thanks, I can confirm that the error is fixed. But now there is a new error:

[INFO] Searching for WebDriver executables installed on the current system...
Selenium Manager binary found at /tmp/selenium/node_modules/selenium-webdriver/bin/linux/selenium-manager
Driver path: /home/pauan/.cache/selenium/chromedriver/linux64/115.0.5790.102/chromedriver
Browser path: /home/pauan/.cache/selenium/chrome/linux64/115.0.5790.102/chrome
The version of edge cannot be detected. Trying with latest driver version
Driver path: /home/pauan/.cache/selenium/msedgedriver/linux64/115.0.1901.188/msedgedriver
The version of firefox cannot be detected. Trying with latest driver version
Driver path: /home/pauan/.cache/selenium/geckodriver/linux64/0.33.0/geckodriver
Driver path: /home/pauan/.cache/selenium/IEDriverServer/win32/4.11.0/IEDriverServer.exe
The version of safari cannot be detected. Trying with latest driver version
/tmp/selenium/node_modules/selenium-webdriver/common/driverFinder.js:35
    throw Error(
    ^

Error: Unable to obtain browser driver.
        For more information on how to install drivers see
        https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location/. Error: Error executing command for /tmp/selenium/node_modules/selenium-webdriver/bin/linux/selenium-manager with --browser,safari,--output,json: safaridriver not available for download
    at getPath (/tmp/selenium/node_modules/selenium-webdriver/common/driverFinder.js:35:11)
    at getAvailableBrowsers (/tmp/selenium/node_modules/selenium-webdriver/testing/index.js:125:6)
    at init (/tmp/selenium/node_modules/selenium-webdriver/testing/index.js:225:59)
    at suite (/tmp/selenium/node_modules/selenium-webdriver/testing/index.js:375:5)
    at Object.<anonymous> (/tmp/selenium/test.js:10:1)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)

I am not using iOS, so it shouldn't even be trying to download the Safari WebDriver.

And it should fail gracefully: if it cannot download the driver, it should just ignore the error and continue.

It's also trying to download some .exe files even though I'm on Linux, so that's odd.

@diemol diemol reopened this Aug 1, 2023
@diemol
Copy link
Member

diemol commented Aug 1, 2023

Will have a look.

@diemol diemol added this to the 4.12 milestone Aug 1, 2023
@diemol diemol closed this as completed in 26e47d1 Aug 11, 2023
@gentlekenny
Copy link

Is the fix coming soon?
I'm having the same issue, with exact same steps as @Pauan, on my M2 Sillicon
I tried safari, mozzila, chrome..same issue

@titusfortner
Copy link
Member

that's the goal. It takes a lot of work to do a release, though

@SattyaP
Copy link

SattyaP commented Aug 22, 2023

Anyone find a solution? I got the error when running the results of my build electron which contains a script to run the selenium when pressing the start button

@titusfortner
Copy link
Member

@SattyaP You have to wait for the next release.

@SattyaP
Copy link

SattyaP commented Aug 22, 2023

@SattyaP You have to wait for the next release.

Ok thanks

@corcoranp
Copy link

@SattyaP

You can disable Safari by commenting out line 125 in the \node_modules\selenium-webdriver\testing\index.js file of your selenium install

//[getPath(new safari.Options()).driverPath, Browser.SAFARI],

This will allow the process to continue with the exception below:

Error: Unable to obtain browser driver.
For more information on how to install drivers see

@SattyaP
Copy link

SattyaP commented Sep 5, 2023

@SattyaP

You can disable Safari by commenting out line 125 in the \node_modules\selenium-webdriver\testing\index.js file of your selenium install

//[getPath(new safari.Options()).driverPath, Browser.SAFARI],

This will allow the process to continue with the exception below:

Error: Unable to obtain browser driver.
For more information on how to install drivers see

Error: Unable to obtain browser driver.
For more information on how to install drivers see
https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location/. Error: Error executing command for E:\Documents\test-spoof\dist\win-unpacked\resources\app.asar\node_modules\selenium-webdriver\bin\windows\selenium-manager.exe with --browser,chrome,--output,json: TypeError: Cannot read properties of null (reading 'toString')
at getPath (E:\Documents\test-spoof\dist\win-unpacked\resources\app.asar\node_modules\selenium-webdriver\common\driverFinder.js:35:11)
at thenableWebDriverProxy.createSession (E:\Documents\test-spoof\dist\win-unpacked\resources\app.asar\node_modules\selenium-webdriver\chromium.js:692:43)
at thenableWebDriverProxy.createSession (E:\Documents\test-spoof\dist\win-unpacked\resources\app.asar\node_modules\selenium-webdriver\chrome.js:224:13)
at createDriver (E:\Documents\test-spoof\dist\win-unpacked\resources\app.asar\node_modules\selenium-webdriver\index.js:152:33)
at Builder.build (E:\Documents\test-spoof\dist\win-unpacked\resources\app.asar\node_modules\selenium-webdriver\index.js:680:16)
at test (E:\Documents\test-spoof\dist\win-unpacked\resources\app.asar\test.js:15:14)
at IpcMainImpl. (E:\Documents\test-spoof\dist\win-unpacked\resources\app.asar\index.js:80:9)
at IpcMainImpl.emit (node:events:513:28)
at WebContents. (node:electron/js2c/browser_init:2:88498)
at WebContents.emit (node:events:513:28)

look same, this error appears when after packaging the electron app which has a ui button to start the function selenium

@titusfortner
Copy link
Member

4.12 is out. The issue should be resolved.

Copy link

github-actions bot commented Dec 6, 2023

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants