Нужно использовать selenium без x-ов.
Пример с оф. странички(http://pypi.python.org/pypi/selenium), как и любые другие вариации:
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
import time
browser = webdriver.Firefox() # Get local session of firefox
browser.get("http://www.yahoo.com") # Load page
assert "Yahoo!" in browser.title
elem = browser.find_element_by_name("p") # Find the query box
elem.send_keys("seleniumhq" + Keys.RETURN)
time.sleep(0.2) # Let the page load, will be added to the API
try:
    browser.find_element_by_xpath("//a[contains(@href,'http://seleniumhq.org')]")
except NoSuchElementException:
    assert 0, "can't find seleniumhq"
browser.close()
запускаемый через xvfb(xvfb-run python example.py) выдает ошибки:Traceback (most recent call last):
  File "test.py", line 11, in <module>
    browser = webdriver.Firefox()
  File "/usr/lib/python2.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 51, in __init__
    self.binary, timeout),
  File "/usr/lib/python2.6/site-packages/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__
    self.binary.launch_browser(self.profile)
  File "/usr/lib/python2.6/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 44, in launch_browser
    self._wait_until_connectable()
  File "/usr/lib/python2.6/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 81, in _wait_until_connectable
    self._get_firefox_output())
selenium.common.exceptions.WebDriverException: Message: 'The browser appears to have exited before we could connect. The output was: Xlib:  extension "RANDR" missing on display ":1108.0".\nfailed to create drawable\n\n(firefox:2030): Pango-WARNING **: failed to choose a font, expect ugly output. engine-type=\'PangoRenderFc\', script=\'common\'\n*** LOG addons.xpi: startup\n*** LOG addons.xpi: checkForChanges\n*** LOG addons.xpi: Opening database\n*** LOG addons.xpi: No changes found\nGConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details -  1: Failed to get connection to session: /bin/dbus-launch terminated abnormally without any error message)\nFailed to dlopen /usr/lib/libX11.so.6\ndlerror says: /usr/lib/libX11.so.6: wrong ELF class: ELFCLASS32\n'С использованием pyvirtualdisplay аналогично.
					
					
 
	 
					 
			
			
