-
Notifications
You must be signed in to change notification settings - Fork 111
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
Fails to start chrome on Mac because the filename contains spaces #139
Comments
My workaround was modifying the local file chrome_finder like this: def mac_version(location)
require 'shellwords'
System.call("#{location.shellescape} --version")&.strip
end |
Hi @dwt, I am unable to reproduce this in v4.0.1. I ran the specs on macOS 10.13.3 (w/ Ruby 2.4.6 and 2.6.3) with log level as
You can view the log here: https://travis-ci.org/kapoorlakshya/webdrivers/jobs/547300790#L242 |
@dwt Are you manually specifying your Chrome location? What version of webdrivers are you using? |
Ah, sorry, I removed that from the bug report because I thought it was irrelevant. Yes, I am manually specifying the location, and I also tried shell-escaping that location, but that doesn't work because then Selenium-WebDriver refuses to start chrome. |
Out of interest, and because I'm not a ruby programmer by trade: I was wondering why you are using backticks to call out to the shell (thus to my understanding actually using a shell to execute those external commands). It seems to me that using a non-shell subprocess call like IO:popen would be a much safer way to call external tools - also not requiring any escaping of spaces in paths. |
* Rake tasks now rely on the core code to handle the ENV vars. * Fix bug where values from the ENV vars had precedence over user defined configs in the project. * Support WD_CHROME_PATH environment variable and use IO.popen to properly escape file paths.
@dwt Thanks for the suggestion. The gem now uses
|
@dwt <https://github.com/dwt> Thanks for the suggestion. The gem now uses IO.popen to handle the system calls. Can you please load this gem from the master branch and confirm the fix works for you? Thanks!
# In Gemfile
gem 'webdrivers', git: 'https://github.com/titusfortner/webdrivers.git <https://github.com/titusfortner/webdrivers.git>', branch: 'master‘
This seems to work perfectly.
:-)
Best Regards,
Martin Häcker
|
Summary
When starting chrome through WebDrivers, WebDrivers asks the chrome binary for its version. This triggers an error as the google chrome binary contains spaces in its path on the Mac.
e.g. this will fail:
`/Applications/Google Chrome.app/Contents/MacOS/Google Chrome --version`
To my understanding the problem is the in system.rb:150 or in chrome_finder.rb:71 as it does not handle spaces in the path.
Debug Info
Please provide the following information for bug reports:
Expected Behavior
Space support in paths is required on Mac.
Actual Behavior
An error like
*** Errno::ENOENT Exception: No such file or directory - /Users/dwt/Applications/Network/Browser/Google
is raisedThe text was updated successfully, but these errors were encountered: