I read through this and I don't quite get it. If I currently run my rspec capybara tests using chromedriver, how will I change that to xvfb ?

I see the examples like Xvfb :1 -screen 0 1600x1200x32 but I'm not sure how to integrate that into my actual UI feature specs.


1 Answer 1


This link explains Firefox browser testing with Capybara: Hope the below link give you an insight of the approach. http://elementalselenium.com/tips/38-headless

Installing xvfb: Example command : For Debian based systems:

apt-get install xvfb

Redhat based systems: yum install xorg-X11-server-Xvfb

Run the script: xvfb-run ruby headless.rb

Executing the script:

Option 1 Start Xvfb on a specific display port and background the process Tell the terminal session to use the display port Run the test Xvfb :99 & export DISPLAY=:99 ruby headless.rb

Option 2 Simply type the below command xvfb-run ruby headless.rb

Option 3

Install the headless gem Update the test setup and teardown to use it Run the test

  • Thanks! the link may go back in the future. Could you post the essential info in case that happens so that future readers still know what you are saying? @Bhavani Feb 2, 2018 at 13:16
  • @MichaelDurrant Updated the answer with the steps.
    – Bhavani
    Feb 2, 2018 at 17:51
  • Nice +1 To accept... Can one replace firefox with chromedriver ? Feb 3, 2018 at 0:18
  • Replaced Firefox with Chromedriver.
    – Bhavani
    Feb 3, 2018 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.