Capybara Webkit Capybara :: Webkit :: ConnectionError failed to start

I use capybara webkit on Ubuntu (14.04 LTS), and when I try to use it, I get the following error:

Capybara::Webkit::ConnectionError: /srv/www/app/shared/bundle/ruby/2.1.0/gems/capybara-webkit-1.3.1/bin/webkit_server failed to start. from /srv/www/app/shared/bundle/ruby/2.1.0/gems/capybara-webkit-1.3.1/lib/capybara/webkit/connection.rb:75:in `parse_port' from /srv/www/app/shared/bundle/ruby/2.1.0/gems/capybara-webkit-1.3.1/lib/capybara/webkit/connection.rb:81:in `discover_port' from /srv/www/app/shared/bundle/ruby/2.1.0/gems/capybara-webkit-1.3.1/lib/capybara/webkit/connection.rb:62:in `start_server' from /srv/www/app/shared/bundle/ruby/2.1.0/gems/capybara-webkit-1.3.1/lib/capybara/webkit/connection.rb:25:in `initialize' from /srv/www/app/shared/bundle/ruby/2.1.0/gems/capybara-webkit-1.3.1/lib/capybara/webkit/driver.rb:17:in `new' 

I installed QT using:

 sudo apt-get install libqt4-dev libqtwebkit-dev libqt5webkit5-dev 

Using gem versions: capybara (2.4.4) and capybara-webkit (1.3.1)

The same program works fine on mac (qt installed using homebrew)

thanks

+6
source share
2 answers

It has been a long time since this question was asked, but I had the same problem, although I used much older versions of something. It turned out that webkit should be able to connect to some X server, and this is his reaction if it fails. I finished installing xvfb and using

  xvfb-run --auto-servernum bundle exec rake test 

(smoothed, of course) while doing my tests. This is probably less than optimal, but for me it was good enough. Perhaps this helps the next person who stumbled upon this error.

+8
source

I hit my head about this all morning. Turns out I skipped this code from rails_helper.rb :

 if ENV['HEADLESS'] require 'headless' headless = Headless.new headless.start at_exit { headless.stop } end 

We use the HEADLESS environment variable to invoke this. Not sure if this is a typical or local convention. Despite this, I had to add export HEADLESS=1 to .env to disable it.

I also had to add the gem 'headless', '~> 1.0.2' to the Gemfile.

+4
source

Source: https://habr.com/ru/post/978725/


All Articles