Question

Can my server open google-chrome (GUI) with Ruby? If not, how can I?

Posted October 16, 2016 2.3k views
Ubuntu PHP Ruby

When I run my Ruby script that requires watir-webdriver which in turn uses Chrome, I get the following Ruby error:

https://gist.github.com/anonymous/8939d7cd5bf39b7e7a36240b614985bc

When I run google-chrome in terminal I get the following error:

[12311:12311:1016/152548:ERROR:browser_main_loop.cc(260)] Gtk: cannot open display:

I have concluded that this must be because the server is GUI-less. How can I work around this?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer

I would recommend checking out xvfb which allows you to have a virtual display and is often used to run apps with a GUI in a headless environment. This guide should be helpful.

Submit an Answer