私はgekodriverをfirefoxに使用していて、python 3にはseleniumを使用しています。 これは私のコードです:SeleniumはPython3でGeckodriverをロードしません
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://www.google.com')
私は私の端末で「のpython3のscript.py」とそれを実行したら、それは、Firefoxを起動しますが、単純にページをロードdoesntの、またそれは、アドレスバーに入力リンクを行います。私geckodriverは、この場所にインストールされます。/ usr/local/binに/ geckodriver
を私は次のエラーを取得する分について待った後:
Traceback (most recent call last):
File "script.py", line 3, in <module>
browser = webdriver.Firefox()
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/firefox/webdriver.py", line 154, in __init__
keep_alive=True)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 151, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 240, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 308, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: connection refused
私はすでに修正のために多くを検索するが、それらのどれも働いていません私は、Firefox ESRの代わりに、通常の1を使用していた実現
は、通常のFirefoxのバージョンに切り替えると、この問題に直面:
Traceback (most recent call last):
ファイル「スクリプトを。 (実行可能パス= r '/ルート/ダウンロード/ firefox-56.0.1/firefox/firefox') のファイル "/usr/local/lib/python3.5/dist-パッケージ/セレン/ webdriver/firefox/webdriver.py "、行144、init self.service.start() ファイル" /usr/local/lib/python3.5/dist-packages/selenium/webdriver/ (サービス "%s"%self.pathに接続できません) selenium.common.exceptions.WebDriverException:メッセージ:Service/rootに接続できません/Downloads/firefox-56.0.1/firefox/firefox
ありがとう。
まだ同じ問題が発生していません。セレンのバージョン= 3.6.0、Geckodriverのバージョン= 0.19.0、Firefoxのバージョン= 52.4.0 –
@ JeroenKouwenhoven私はちょうど答えを編集しました。 –
私は通常のFirefoxの代わりにFirefox ESRを使用していましたが、通常のFirefoxに切り替えて、同じ問題に直面しています。新しいエラーで元の投稿を編集しました。 –