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

selenium-webdriver doesn't work with NPM-installed geckodriver.exe #30

Closed
mykmelez opened this issue Aug 28, 2017 · 5 comments
Closed

Comments

@mykmelez
Copy link
Contributor

#29 didn't work quite as well as I thought at first. It does make geckodriver.exe available on the PATH, and I thought that enabled selenium-webdriver to successfully find and run it in my tests last week.

But I tested again this morning, and selenium-webdriver now silently fails after I install geckodriver via this NPM package. So perhaps I made a mistake last week when running tests on my modified version of this package.

In MozillaBuild, running geckodriver.exe complains:

$ geckodriver.exe
bash: /c/Users/myk/AppData/Roaming/npm/geckodriver.exe: /bin/sh: bad interpreter: Bad file number

In a standard cmd.exe terminal, running geckodriver.exe complains:

C:\Users\myk\project-dir>geckodriver.exe
This version of C:\Users\myk\AppData\Roaming\npm\geckodriver.exe is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.

It also displays an Unsupported 16-Bit Application dialog window with the message:

The program or feature "??\C:\Users\myk\AppData\Roaming\npm\geckodriver.exe" cannot start or run due to incompatibility with 64-bit versions of Windows. Please contact the software vendor to ask if a 64-bit Windows compatible version is available."

I suspect this is due to the .exe file extension overriding the shebang line in the Node script that NPM installs as geckodriver.exe, and we'll need a different solution for the problem, perhaps copying the actual geckodriver.exe file to a location in the PATH in the postinstall.js script.

@mykmelez
Copy link
Contributor Author

Update: over in #31, I tried copying geckodriver.exe in the postinstall script. Over in https://github.com/mykmelez/node-geckodriver/tree/link-geckodriver-exe I made that implementation link the file instead of copying it.

Alas, neither solution is sufficient, for reasons described in #31, so in #32 I've reverted #29 and added a section to the README that describes how to manually link geckodriver.exe on Windows.

@mykmelez
Copy link
Contributor Author

Here's the workaround for readers of this issue (so you don't have to go find the README): manually link geckodriver.exe on Windows (after installing this package globally) via this mklink command in a cmd.exe terminal:

mklink %USERPROFILE%\AppData\Roaming\npm\geckodriver.exe %USERPROFILE%\AppData\Roaming\npm\node_modules\geckodriver\geckodriver.exe

@jnachtigall
Copy link

FWIW, I could not get geckodriver running on Windows10 for WebDriverJS using npm. The geckodriver.exe was always not found. I did also add the mlink, but no success.

In the end I gave up and installed geckodriver manually and added it to the system PATH. So this does not look like it is working out of the box.

@jnachtigall
Copy link

Forget my last comment. I got it working in a node project on Windows 10 as dependency with npm install geckodriver --save and then in the relevant js file also doing a require('geckodriver');

@christian-bromann
Copy link
Contributor

Thanks all, let me know if anyone still experiences this issue and I am happy to re-open.

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

No branches or pull requests

3 participants