Firefox WebDriver的实例不是使用selenium python绑定创建的

时间:2012-06-22 10:01:27

标签: python firefox selenium webdriver

我安装了selenium-python绑定并尝试创建firefox Web驱动程序的实例 如下

>>> from selenium import webdriver
>>> driver = webdriver.Firefox()

我不知道这里有什么错,它显示以下错误

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/selenium-2.21.3-py2.7.egg/selenium/webdriver/firefox/webdriver.py", line 51, in __init__
    self.binary, timeout),
  File "/usr/lib/python2.7/site-packages/selenium-2.21.3-py2.7.egg/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__
    self.binary.launch_browser(self.profile)
  File "/usr/lib/python2.7/site-packages/selenium-2.21.3-py2.7.egg/selenium/webdriver/firefox/firefox_binary.py", line 44, in launch_browser
    self._wait_until_connectable()
  File "/usr/lib/python2.7/site-packages/selenium-2.21.3-py2.7.egg/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: Error: cannot open display: :1100\n' 

请知道如何解决这个问题..............

1 个答案:

答案 0 :(得分:1)

错误显示“无法打开显示:: 1100”。你在远程终端上运行它吗?确保您可以在提示符下键入“firefox”并打开浏览器(这就是Webdriver所做的 - 在您的系统上打开Firefox,然后尝试连接到它)。如果您在远程系统上运行它,请在远程连接到X显示器时进行Web搜索。