が私の環境である:python selenium 3.0 - デフォルトの場所にインストールされたFirefox 47.0.1は識別されません。続き(geckodriver)
- OS:Windowsの10から64(ホーム版)
- ブラウザ:Firefoxの47.0.1(32ビット)
- のPython:2.7.10.12(64ビット)
- セレン:3.0.1
- Geckodriver:Firefoxのはにインストールされている
geckodriver-v0.11.1-win64.zip 10。
geckodriver.exeはC:\Python27\Scripts
に配置されています。
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("http://www.python.org")
次のエラーを与える:後
は私のPythonコードである
Traceback (most recent call last):
File "examples1.py", line 5, in <module>
driver = webdriver.Firefox()
File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 152, in __init__
keep_alive=True)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 92, in __init__
self.start_session(desired_capabilities, browser_profile)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 179, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line
私の質問はFirefoxがデフォルトの場所にインストールされているが、webdriverをはそれを見つけることができなかったことですエラーをスローします。
注:次のようにFirefoxのバイナリの場所を明示的に指定すると機能しています。
binary = FirefoxBinary(r'C:\Program Files (x86)\Mozilla Firefox\firefox.exe')
driver = webdriver.Firefox(firefox_binary=binary)
問題の内容がわかりません。マシンを再起動した後、私は期待どおりに働いています.e.e。、Firefoxのバイナリの場所を使用して場所を指定しなくても、デフォルトの場所からブラウザを起動しました。私はそれが輸入の問題ではないと確信しています。 –
私はこれがどういう意味か分かりません: "PythonはFirefoxBinary関数を直接見つけることができませんでした" ...しかし、この答えは正しくありません。 –