linux - [Solved-5 Solutions] How to run Selenium in Xvfb Linux ? - ubuntu - red hat - debian - linux server - linux pc
Linux - Problem :
How to run Selenium in Xvfb Linux ?
Linux - Solution 1:
Open a terminal and run this command xhost +. This commands needs to be run every time you restart your machine.
Additionally make sure in your /etc/environment file there is a line
Linux - Solution 2:
You can use PyVirtualDisplay (a Python wrapper for Xvfb) to run headless WebDriver tests.
You can also use xvfbwrapper, which is a similar module (but has no external dependencies):
Use it as a context manager:
Linux - Solution 3:
The easiest way is probably to use xvfb-run:
Linux - Solution 4:
Before running the tests, execute:
And after the tests:
Here you can use init.d file like this:
Linux - Solution 5:
In my case on CentOS 7:
Packages:
Display:
simple test: