2016-11-15 82 views
0

我正在嘗試運行無頭硒並與之交手我已經在數字海洋(Ubuntu 16)上設置了新的液滴。如何在Ubuntu服務器上運行無頭硒

我正在關注this tutorial,但在運行腳本時出現以下錯誤。

Traceback (most recent call last): 
    File "pyvirtualdisplaytest.py", line 12, in <module> 
    browser = webdriver.Firefox() 
    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 135, in __init__ 
    self.service.start() 
    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 71, in start 
    os.path.basename(self.path), self.start_error_message) 
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH. 

Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x7f981d0dc190>> ignored 

我該怎麼辦?謝謝你的幫助。

回答

0

https://github.com/mozilla/geckodriver/releases/tag/v0.11.1

出口PATH = $ PATH下載壁虎司機:中/ loaction下載geckodriver

運行代碼。

如果出現以下情況例外

selenium.common.exceptions.WebDriverException:消息:預計 瀏覽器的二進制位置,但無法找到默認 位置,沒有二進制「MOZ:firefoxOptions.binary」能力提供,並沒有 比納RY標誌在命令行上設置

請,檢查geckodriver和Firefox應該是32或64位

否則。使用FireFoxBinary對象將代碼中的FirefoxBinary路徑提供給FirefoxDriver()。

相關問題