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

Can't run Chrome webdriver #3170

Closed
pmontrasio opened this issue Jul 23, 2015 · 21 comments
Closed

Can't run Chrome webdriver #3170

pmontrasio opened this issue Jul 23, 2015 · 21 comments

Comments

@pmontrasio
Copy link

This is the error I get when running Selenium with chrome

 Selenium::WebDriver::Error::WebDriverError:
   unable to connect to chromedriver http://127.0.0.1:9515
 # /home/me/.rvm/gems/jruby-9.0.0.0.pre1@myproject/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/chrome/service.rb:50:in `__script__'
 # /home/me/.rvm/gems/jruby-9.0.0.0.pre1@myproject/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/chrome/bridge.rb:15:in `__script__'
 # /home/me/.rvm/gems/jruby-9.0.0.0.pre1@myproject/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/common/driver.rb:37:in `__script__'
 # /home/me/.rvm/gems/jruby-9.0.0.0.pre1@myproject/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver.rb:67:in `__script__'
 # /home/me/.rvm/gems/jruby-9.0.0.0.pre1@myproject/gems/capybara-2.4.4/lib/capybara/selenium/driver.rb:13:in `__script__'
 # /home/me/.rvm/gems/jruby-9.0.0.0.pre1@myproject/gems/capybara-2.4.4/lib/capybara/selenium/driver.rb:45:in `visit'
 # /home/me/.rvm/gems/jruby-9.0.0.0.pre1@myproject/gems/capybara-2.4.4/lib/capybara/session.rb:227:in `visit'
 # /home/montra/.rvm/gems/jruby-9.0.0.0.pre1@myproject/gems/capybara-2.4.4/lib/capybara/dsl.rb:51:in `visit'

The driver has been set up with

Capybara.register_driver :selenium do |app|
  Capybara::Selenium::Driver.new(app, browser: :chrome)
end

This could be a bug of the Chrome webdriver not supporting JRuby but I'm starting from here because it could be caused by some peculiarity of the Java environment.

@nirvdrum
Copy link
Contributor

Just to be clear, you were able to verify this works with MRI? The reason I ask is chromedriver requires a separate download and installation. The selenium-webdriver gem then uses this downloaded binary.

@pmontrasio
Copy link
Author

Yes, it works with MRI. This is a Rails 4.2 / Ruby 2.2.2 project that I'm trying to run with JRuby 9.0.0.0
I rerun the tests with MRI right now to be sure everything is OK.

@clonezone
Copy link

I'm running into a similar issue with JRuby v9.0.0.0 final. No Capybara, but direct use of selenium-webdriver v2.46.2. Works fine with Rubinius v2.5.7.

@rtyler
Copy link

rtyler commented Aug 2, 2015

@pmontrasio @clonezone would either of you have a simple reproduction case that we could use to verify a fix for this? My experience with Capybara/Selenium is about three years old at this point, but I have a hunch that this might have to do with process spawning

@clonezone
Copy link

require 'selenium-webdriver'

webdriver = Selenium::WebDriver.for :chrome
webdriver.quit

On Ubuntu v14.04.2 LTS, with Chrome v40, Chromedriver v2.10.267518, selenium-webdriver v2.46.2, and Rubinius v2.5.7, this works: the browser gets launched and shuts down. (You need to have Chrome and Chromedriver in your PATH.)

With everything else the same, switching to JRuby v9.0.0.0 results in

Selenium::WebDriver::Error::WebDriverError: unable to connect to chromedriver 127.0.0.1:9515
  connect_until_stable at /install/path/gems/selenium-webdriver-2.46.2/lib/selenium/webdriver/chrome/service.rb:109
        block in start at /install/path/gems/selenium-webdriver-2.46.2/lib/selenium/webdriver/chrome/service.rb:69
                locked at /install/path/gems/selenium-webdriver-2.46.2/lib/selenium/webdriver/common/socket_lock.rb:38
                 start at /install/path/gems/selenium-webdriver-2.46.2/lib/selenium/webdriver/chrome/service.rb:66
            initialize at /install/path/gems/selenium-webdriver-2.46.2/lib/selenium/webdriver/chrome/bridge.rb:34
                   for at /install/path/gems/selenium-webdriver-2.46.2/lib/selenium/webdriver/common/driver.rb:56
                   for at /install/path/gems/selenium-webdriver-2.46.2/lib/selenium/webdriver.rb:84
                 <top> at selenium-test:3

Note that the browser does launch with JRuby; it’s communication with the browser process that's the issue.

@reach2jeyan
Copy link

@clonezone I am facing the same error currently in travis CI. Any idea how did you debug the issue?

PFB the log generated.

https://api.travis-ci.org/jobs/201592573/log.txt?deansi=true

@clonezone
Copy link

clonezone commented Feb 14, 2017 via email

@reach2jeyan
Copy link

@clonezone: Okay! It was the issue with 2.7 version of chrome driver. I downgraded to 2.27, it works now.

Thanks

@venu14feb
Copy link

I have encountered the same issue, but downgrading the chrome driver to 2.27 did not resolve it.

@reach2jeyan
Copy link

@venu14feb What is the error you are getting, can you please paste the logs

@venu14feb
Copy link

@reach2jeyan, I am getting the below error:
unable to connect to chromedriver 127.0.0.1:9515 (Selenium::WebDriver::Error::WebDriverError)

@headius
Copy link
Member

headius commented Apr 19, 2017

This appears to be working fine on JRuby master on my system...

~/projects/jruby $ gem install selenium-webdriver
Fetching: rubyzip-1.2.1.gem (100%)
Successfully installed rubyzip-1.2.1
Fetching: ffi-1.9.18-java.gem (100%)
Successfully installed ffi-1.9.18-java
Fetching: childprocess-0.6.3.gem (100%)
Successfully installed childprocess-0.6.3
Fetching: websocket-1.2.4.gem (100%)
Successfully installed websocket-1.2.4
Fetching: selenium-webdriver-3.3.0.gem (100%)
Successfully installed selenium-webdriver-3.3.0
5 gems installed

~/projects/jruby $ sudo dnf install chromedriver
[sudo] password for headius: 
Last metadata expiration check: 0:51:25 ago on Wed Apr 19 08:59:03 2017.
Dependencies resolved.
...
Installed:
  chromedriver.x86_64 57.0.2987.133-1.fc25                           chromium-libs.x86_64 57.0.2987.133-1.fc25                           chromium-libs-media.x86_64 57.0.2987.133-1.fc25                          

Complete!

~/projects/jruby $ jruby blah.rb

~/projects/jruby $ cat blah.rb
require 'selenium-webdriver'

webdriver = Selenium::WebDriver.for :chrome
webdriver.quit

@headius
Copy link
Member

headius commented Apr 19, 2017

As near as I can tell, the chromedriver installed on my Fedora appears to be in the 2.29 range, since it's for Chrome 57. All I did was gem install selenium-webdriver and dnf install chromedriver and it works, so I'm not sure what else to do here.

@venu14feb Can you give more details about your environment?

@venu14feb
Copy link

@headius, I am trying to run the cucumber scripts and using Ruby.
The environment:

  • ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32]
  • chromedriver - have tried with 2.27 and 2.29

(The issue started after upgrading my machine to Windows 10. It asked to upgrade Ruby that supports 64 bit and I did)

May I know what 'dnf install chromedriver' does? May be I couldn't find this command as I am using Ruby and not JRuby.

@headius
Copy link
Member

headius commented Apr 19, 2017

Well, we can't help with C Ruby issues. If you are having the trouble with a current JRuby release, let us know.

@headius headius closed this as completed Apr 19, 2017
@reach2jeyan
Copy link

@venu14feb If you are using ruby, could you please place the chromedriver in the lib file of the ruby and check?

@venu14feb
Copy link

@headius .. Sorry if this was the wrong post.

@reach2jeyan .. Yes I did place the chromedriver.exe file in the bin folder and the same was defined in the path to be launched. Seems like the issue is to do with Windows 10 being 64 bit.
Will keep you posted after I find a resolution. Thanks for your assistance!

@venu14feb
Copy link

@reach2jeyan ... The issue is, can't run the cucumber scripts from command prompt on windows 10 (which was fine on windows 7). Don't know why. But I found a solution, I installed the rubymine IDE and its running the scripts successfully now.

@reach2jeyan
Copy link

@venu14feb Strange...! How could an IDE resolve the issue of chromedriver?

@enebo enebo added this to the Invalid or Duplicate milestone May 11, 2017
@sidh12
Copy link

sidh12 commented Jun 25, 2018

Hi all can anyone help me to resolve the issue
'ArgumentError: cannot interpret as DNS name: nil'
the error is coming when doing capybara selenium integration testing in rails 4
here iam using jruby-1.7.9 and ruby version inside jruby is 2.0.0p195
already i had used the ruby version is 1.9.7 at that time i faced the error
'cant connect to chrome driver error'
in pure ruby like without using jruby its the integration testing is working...but my application is in jruby... and iam using ubuntu platform...
so, anyone have any solution on this.. wat should i do to resolve this??
Thanks in advance

@headius
Copy link
Member

headius commented Jun 25, 2018

@sidh12 Unfortunately JRuby 1.7.x is not supported anymore. The error you get here appears to be trying to pass a nil value as DNS host when doing a lookup, but I don't know much more. If you stop by IRC or Gitter we may be able to help, but updating to JRuby 9.x is almost certainly your best path forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants