Docker + Rspec + Capybara - arguments[0] is undefi

2019-02-22 03:11发布

问题:

I'm trying to get my specs working headlessly in docker - They run fine locally on my mac but when I run them inside the docker container I get this error (repeated multiple times)

Selenium::WebDriver::Error::JavascriptError:
   arguments[0] is undefined
 # [remote server] https://foobar.com/ line 68 > Function:1:1:in `anonymous'
 # [remote server] https://foobar.com/:68:20:in `handleEvaluateEvent'
 # ./spec/features/foo_spec.rb:15:in `block (2 levels) in <top (required)>

Xvfb is running: Xvfb :99.0 -screen 0 1366x768x16

I've also tried doing a xvfb-run rspec and got the same errors.

spec_helper.rb:

Capybara.default_driver = :selenium
Capybara.javascript_driver = :selenium

What's going on that this can't run inside docker?

回答1:

The reason for this error is this:

>> webdriver.execute_script("return typeof arguments[0]", "foo")
=> "undefined"

Apparently this is a bug with Firefox 35 and webdriver. There is an issue open for it - https://code.google.com/p/selenium/issues/detail?id=8390.