Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
183 views
in Programming by
recategorized by

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

0 like 0 dislike
by

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!

 


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...