0
我有一個簡單的Python腳本不工作:Python的硒不工作
#!/usr/bin/env python
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://seleniumhq.org/')
不過我,當我嘗試運行它收到此錯誤:
Traceback (most recent call last):
File "./test.py", line 5, in <module>
browser = webdriver.Firefox()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 103, in __init__
self.binary, timeout)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/extension_connection.py", line 51, in __init__
self.binary.launch_browser(self.profile, timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 68, in launch_browser
self._wait_until_connectable(timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 98, in _wait_until_connectable
raise WebDriverException("The browser appears to have exited "
selenium.common.exceptions.WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details.
我運行硒版本:
Name: selenium
Version: 2.53.2
火狐版本:
ii firefox-mozilla-build 14.0.1-0ubuntu1 amd64 Mozilla Firefox, official Mozilla build, packaged for Ubuntu by the Ubuntuzilla project.
您是否嘗試過這裏列出的解決方案? http://stackoverflow.com/questions/26070834/how-to-fix-selenium-webdriverexception-the-browser-appears-to-have-exited-befor – lonewaft
@lonewaft剛剛嘗試過。沒有解決問題。我相信硒版本和Firefox之間存在問題。但沒有找到任何有關哪個版本的硒支持Firefox的文檔等 – user3270211
只是一個方面說明:你應該更新你的瀏覽器,它已經過時了。最近的版本是46.0.1。 –