Installing Xvfb in Centos 6-7

Xvfb, or X virtual frame buffer is needed by selenium and chromedriver or gekodriver, so it can srun via cron with your PC locked, or without your script taking focus from the user section

The Xvfb, or “X virtual frame buffer” will allow scripts and apps to run, within their own virtual x windows session. It allows you to write chromedriver scripts to do cool things on the web, and run them without them stealing focus in your local session.

# yum install -f chromedriver chromium xorg-x11-server-Xvfb
Example Python utilizing a virtual framebuffer:
from selenium import webdriver  
from pyvirtualdisplay import Display  
display = Display(visible=0, size=(800, 800))  
outputdir = "/tmp"  
options = webdriver.ChromeOptions()  
options.binary_location = '/bin/google-chrome'  
service_log_path = "{}/chromedriver.download_tax_rates.log".format(outputdir)  
service_args = ['--verbose']  
driver = webdriver.Chrome('/bin/chromedriver',  

#open connection
# driver = webdriver.Chrome()
#open chrome to first page

Leave a Reply

Your email address will not be published. Required fields are marked *