I'm trying to run Selenium headless (without the browser appearing). Other questions have pointed to xvfb
as the tool to do this. However, it appears highly unstable, crashing all the time, so I'm looking for another alternative.
Is there a non-xvfb way of running Selenium headless?
ChromeOptions options = new ChromeOptions() options. addArgument("headless"); ChromeDriver driver = new ChromeDriver(options); In the above code, the browser is instructed to run in the headless mode using the addArgument() method of the ChromeOptions class provided by the Selenium WebDriver.
Xvfb (short for X virtual framebuffer) is an in-memory display server for UNIX-like operating system (e.g., Linux). It enables you to run graphical applications without a display (e.g., browser tests on a CI server) while also having the ability to take screenshots.
Improved speed and performance Selenium tests can take a while to complete, due to elements on a page that the browser needs to load. Headless testing gets rid of this load time, allowing you to cut your testing times significantly. In our tests with headless testing, we've seen a 30% reduction of test execution times.
Test Studio currently supports the headless mode for Chrome and Edge Chromium browsers. You can execute any existing test in your automation project in headless mode by selecting that type of browser.
I don't think you'll be able to run a browser without running an X server.
If you don't like Xvfb, then as Pascal said, your best bet might be to run a VNC server -- I personally like Xtightvnc. This means you're running a (headless) X server that you can VNC into at any time, in case things go wrong and you want to look at it. I always have a VNC server running, and I'm running my tests with the $DISPLAY environment variable pointing to that server.
(Someone's downvoted me, so maybe I should clarify: X11 VNC servers like Xtightvnc are not the same as the usual VNC servers on Windows or OS X, which would simply share your existing screen on the network. Do not confuse. ;-) )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With