Skip to content
This repository has been archived by the owner on Apr 1, 2019. It is now read-only.

Can't get this working in trivial case #75

Closed
kwerle opened this issue Jan 11, 2019 · 7 comments
Closed

Can't get this working in trivial case #75

kwerle opened this issue Jan 11, 2019 · 7 comments

Comments

@kwerle
Copy link

kwerle commented Jan 11, 2019

chromedriver-helper does not seem to work in a virgin docker container with a new rails application.

What follows are the step by step to:

  • Add rails
  • Create a new rails application in a docker container
  • Enable mimi_racer
  • Add a user scaffold
  • Add libnss3 (which chrome seems to need and which is not installed by default)
  • Run the system tests - which do invoke chromedriver-helper but which do not work
➜  docker run -it -v $PWD:/empty -w /empty ruby bash
root@4b7f2d3dc8ac:/empty# gem install rails
...
38 gems installed
root@4b7f2d3dc8ac:/empty# rails new fail_helper
...
* bin/rails: spring inserted
root@4b7f2d3dc8ac:/empty# cd fail_helper/

<<EDIT Gemfile to enable mini_racer>>

root@4b7f2d3dc8ac:/empty/fail_helper# bundle
...
Bundled gems are installed into `/usr/local/bundle`
root@4b7f2d3dc8ac:/empty/fail_helper# rails g scaffold user name:string
...
      create    app/assets/stylesheets/scaffolds.scss
root@4b7f2d3dc8ac:/empty/fail_helper# bin/rails db:migrate RAILS_ENV=test
== 20190111231241 CreateUsers: migrating ======================================
-- create_table(:users)
   -> 0.0078s
== 20190111231241 CreateUsers: migrated (0.0079s) =============================

root@4b7f2d3dc8ac:/empty/fail_helper# apt-get update && apt-get install -y libnss3 # libnss3 is needed by chrome.
...
root@4b7f2d3dc8ac:/empty/fail_helper# bin/rails test:system
Run options: --seed 49850

# Running:

E

Error:
UsersTest#test_creating_a_User:
Selenium::WebDriver::Error::UnknownError: unknown error: cannot find Chrome binary
  (Driver info: chromedriver=2.45.615279 (12b89733300bd268cff3b78fc76cb8f3a7cc44e5),platform=Linux 4.9.125-linuxkit x86_64)
    test/system/users_test.rb:14:in `block in <class:UsersTest>'

So... what happened?

root@4b7f2d3dc8ac:/empty/fail_helper# ls ~/.chromedriver-helper/2.45/linux64/chromedriver
/root/.chromedriver-helper/2.45/linux64/chromedriver

<< It got installed... >>

root@4b7f2d3dc8ac:/empty/fail_helper# /root/.chromedriver-helper/2.45/linux64/chromedriver
Starting ChromeDriver 2.45.615279 (12b89733300bd268cff3b78fc76cb8f3a7cc44e5) on port 9515
Only local connections are allowed.
[1547248893.082][SEVERE]: bind() failed: Cannot assign requested address (99)

<< It runs >>

It got installed and it runs - why is it not functioning in test:system?

I'm happy to create a project and/or dockerfile with this test case if that'd help.

@flavorjones
Copy link
Owner

Thanks for asking this question. This appears to be a chromedriver issue, and not an issue with chromedriver-helper. This gem simply downloads the binary and starts it, and both of those operations appear to be working correctly.

I googled the error message you posted and found lots of related posts, including this post (and others) indicating the root cause might be related to IPv6 configuration:

https://www.reddit.com/r/docker/comments/8zkmuo/chromedriver_not_starting_in_docker/

You may want to check out some of those results, or else solicit some assistance in a different forum? I don't think there's anything this gem could be doing differently to prevent a failure to bind to a port here.

Sorry I can't be of more help to you.

@kwerle
Copy link
Author

kwerle commented Jan 12, 2019

Sorry the output wasn't clear.
chromedriver-helper does install chromedriver. And chromedriver does run - the spurious error that is probably IPv6 related notwithstanding. When I ran it manually the error message was just the last thing it said - it continued running.

The issue seems to be entirely in 'helpers area:

Selenium::WebDriver::Error::UnknownError: unknown error: cannot find Chrome binary
  (Driver info: chromedriver=2.45.615279 (12b89733300bd268cff3b78fc76cb8f3a7cc44e5),platform=Linux 4.9.125-linuxkit x86_64)
    test/system/users_test.rb:14:in `block in <class:UsersTest>'

It does seem like 'helper should be able to find the driver it just installed, right? And since I was able to run it, it seems like 'helper should be able to do so, too?

@flavorjones
Copy link
Owner

OK - I see, I jumped to the end. Yes, please, a docker image would help to reproduce and debug this.

@flavorjones flavorjones reopened this Jan 12, 2019
@kwerle
Copy link
Author

kwerle commented Jan 12, 2019

@twalpole
Copy link

Note the error says "cannot find Chrome binary" - not cannot find chromedriver binary -- does your docker image actually have Chrome on it?

@kwerle
Copy link
Author

kwerle commented Jan 13, 2019 via email

@flavorjones
Copy link
Owner

I'm going to close this issue, as the gem is being deprecated in favor of webdrivers, see #83.

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

3 participants