Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Close Xvfb after usage

I am running some tests in headless firefox using Xvfb. However, after my tests are finished I want to move back to normal display. But I am not able to do that .Here is What I am doing .

  1. Open A Terminal
  2. sudo Xvfb :10 -ac &
  3. export DISPLAY=:10
  4. Execute My Tests using RobotFramework+ Selenium

After step 4, I want to open the firefox in the same terminal but I am not able to see it as it is directed towards :10 display.

I wonder how can I shut this (xvfb :10) down so that I can open firefox and view it.

like image 440
NODE.NODE Avatar asked Jul 21 '14 16:07

NODE.NODE


1 Answers

The simple solution is to keep the old value of DISPLAY, change it to point to the xvfb, and then after the test is run you can change it back to the saved value.

This leaves the xvfb running, so you should also get the pid of that process and kill it. Otherwise, if you run this set of steps a dozen times, you'll have a dozen xvfb processes running in the background.

like image 74
Bryan Oakley Avatar answered Oct 01 '22 16:10

Bryan Oakley