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

capybara-webkit, qtwebkit

Solution

It has been a long time since this question was asked, but I had the same problem even though I used much more ancient versions of anything. It turned out that `webkit` needs to be able to connect to some X-Server and this is its reaction if it fails. I ended up installing `xvfb` and using

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

(aliased of course) when running my tests. This is probably less than optimal, but it was good enough for me. Maybe this helps the next person who stumbles across this error.

Problem

I'm using capybara webkit on Ubuntu (14.04 LTS) and I'm getting the following error when trying to use it: ``` 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

Original source