2012-06-22 65 views
4

我裝硒Python綁定,並試圖創造Firefox網頁駕駛員 的實例如下實例沒有與硒Python綁定

>>> 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

錯誤說「不能運顯示器::1100「。你在遠程終端上運行它嗎?確保你可以在提示符下輸入「firefox」,並打開瀏覽器(這是Webdriver所做的 - 在系統上打開Firefox,然後嘗試連接到它)。如果您正在遠程系統上運行它,請執行網頁搜索以遠程連接到X顯示器。

+0

不,我運行它在我的終端上的Fedora在Python shell –