Can any one explain in detail about running selenium tests using Xvfb?

Open 1 Answers 47 Views Programming
0 1

How to use Xvfb in selenium tests?

I am using linux ubuntu - I already have xvfb on my machine .

I have started it : Xvfb  :1 -screen 0 1300x1200x32

then exported :

export DISPLAY:1.0

After that - I dont how to run my selenium tests  on command line ?

Pleasse xplain the procedure?

Whether it  is easy to run Xvfb using a maven goal : selenium:xvfb?

How and which option is a best practice?

Please provide an example if possible.

1 Answer


Xvfb will create a GUI for you where you can invoke your browser. So, to execute selenium tests, if you are using maven and JUnit, you can simply use below command

mvn clean test

Make sure that your RemoteWebDriver class is pointing to the IP of your ubuntu machine. I will suggest you use VNC and make sure that you have your browser properly installed.

As a side note, you should use such setup only for quick smoke testing. You can't really simulate browser combination here. Like Firefox on Windows will act differently than Firefox on Linux box.

Hope that helps!


answered by

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

We have resolved 1.2k+ Software Testing queries!

Top Contributors