Capybara selenium xvfb throwing end of file error after recent update of Ubuntu 16.04

ⅰ亾dé卋堺 提交于 2019-12-12 02:19:35

问题


Currently in my Ruby on Rails application cucumber test are being run with the capybara gem and using selenium.

Recently after a system update to Ubuntu 16.04 the tests started failing with EOFError: end of file reached errors

Additionally, it also occasionally includes the following error.

session not created exception
from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData": "frameId":"14314.1","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: chrome=54.0.2840.59)
(Driver info: chromedriver=2.21.371461 (633e689b520b25f3e264a2ede6b74ccc23cb636a),platform=Linux 4.4.0-43-generic x86_64) (Selenium::WebDriver::Error::SessionNotCreatedError)

This question also refers to something similar but with minitest.

This what I believe to be the relevant part of the capybara env.rb file:

require 'cucumber/rails'
require 'capybara'
require 'capybara/cucumber'
require 'capybara-screenshot'
require 'capybara-screenshot/cucumber'
require 'rails/test_help'
require 'minitest/rails'
require 'mocha/mini_test'
require 'headless'
require 'selenium-webdriver'
require 'rack_session_access/capybara'
require 'webmock/cucumber'
WebMock.allow_net_connect!
include Sprig::Helpers

ActionController::Base.allow_rescue = false
Dir.mkdir('test_result') unless File.exist?('test_result')
# Remove/comment out the lines below if your app doesn't have a database.
# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
begin
 DatabaseCleaner.strategy = :truncation, { only: [] }
 DatabaseCleaner.clean_with :truncation, { only: [] }  

rescue NameError
  raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end

Capybara.register_driver :selenium do |app|
  client = Selenium::WebDriver::Remote::Http::Default.new
  client.timeout = 15
  Capybara::Selenium::Driver.new(app, browser: :chrome, http_client: client)
end

Capybara.default_driver = :selenium
Capybara.javascript_driver = :selenium
Capybara.raise_server_errors = true
Capybara.default_selector = :css
Capybara.default_max_wait_time = 15
Capybara.save_and_open_page_path = 'tmp/capybara'

I've looked over at a thread in the capybara-webkit gem that looks related, but I'm not actually using webkit.

Any help would be appreciated.


回答1:


Turns out I'm using a gem called chromedriver-helper that was using rbenv to override the version of chromedriver that was actually being used by capybara and selenium to run the tests. The gem readme said to try running chromedriver-update in the context of the rails app, which cleared everything up.



来源:https://stackoverflow.com/questions/40138010/capybara-selenium-xvfb-throwing-end-of-file-error-after-recent-update-of-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!