如何让 Selenium 在 Centos 6.0 上工作?我收到以下错误。我在 python 2.6 上使用 selenium 2.31.0
yum install ImageMagick ImageMagick-perl xorg-x11-server-Xephyr Xvfb firefox
sudo yum -y install python-imaging
sudo easy_install pyvirtualdisplay
sudo easy_install selenium
from pyvirtualdisplay import Display
from selenium import webdriver
import time
import argparse
import os
display = Display(visible=0, size=(800, 600))
display.start()
browser = webdriver.Firefox()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/site-packages/selenium-2.31.0-py2.6.egg/selenium/webdriver/firefox/webdriver.py", line 58, in __init__
self.binary, timeout),
File "/usr/lib/python2.6/site-packages/selenium-2.31.0-py2.6.egg/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__
self.binary.launch_browser(self.profile)
File "/usr/lib/python2.6/site-packages/selenium-2.31.0-py2.6.egg/selenium/webdriver/firefox/firefox_binary.py", line 48, in launch_browser
self._wait_until_connectable()
File "/usr/lib/python2.6/site-packages/selenium-2.31.0-py2.6.egg/selenium/webdriver/firefox/firefox_binary.py", line 95, in _wait_until_connectable
self.profile.path, self._get_firefox_output()))
selenium.common.exceptions.WebDriverException: Message: 'Can\'t load the profile. Profile Dir: /tmp/tmpUYQhu2 Firefox output: Xlib: extension "RANDR" missing on display ":1170.0".
*** LOG addons.xpi: startup
*** LOG addons.xpi: Ignoring file entry whose name is not a valid add-on ID: /home/efuadmin/.mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/.fedora-langpack-install
*** LOG addons.xpi: checkForChanges
*** LOG addons.xpi: No changes found'