2017-08-05 196 views
0

這是我使用的代碼。Web驅動程序異常

from selenium import webdriver 
from selenium.webdriver.common.keys import Keys 

driver = webdriver.Firefox() 
driver.get("https://172.16.16.16/24online/servlet/E24onlineHTTPClient") 

當我嘗試爲Firefox運行腳本時發生此異常。
請幫我這個

Traceback (most recent call last): 
    File "D:\Labs\Ion\pwner.py", line 4, 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", l 
ine 98, in __init__ 
    self.start_session(desired_capabilities, browser_profile) 
    File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", l 
ine 188, in start_session 
    response = self.execute(Command.NEW_SESSION, parameters) 
    File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", l 
ine 256, in execute 
    self.error_handler.check_response(response) 
    File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py" 
, line 194, in check_response 
    raise exception_class(message, screen, stacktrace) 
selenium.common.exceptions.WebDriverException: Message: Unable to find a matchin 
g set of capabilities 
+0

你能告訴我們你的代碼塊和研究嗎?謝謝 – DebanjanB

+0

Selenium,GeckoDriver,Mozilla Firefox版本請。謝謝 – DebanjanB

+0

硒3.4.3; GeckoDriver 0.18; Firefox 54.0.1 –

回答

0

升級的Firefox應該可以解決這個問題,你可以嘗試升級硒,以及如果你想確保...

+0

我有最新的firefox latest firefox –

+0

你的FF版本是什麼? – QuakeCore

+0

我的Firefox是54.0.1 –

0

當你與Selenium 3.4.3工作,geckodriver v.0.18.0Mozilla Firefox 53.0使用Python下面的代碼塊將打開所需的URL:

from selenium import webdriver 
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary 

binary = FirefoxBinary(r'C:\Program Files\Mozilla Firefox\firefox.exe') 
driver = webdriver.Firefox(firefox_binary=binary, executable_path=r'C:\Utility\BrowserDrivers\geckodriver.exe') 
driver.get('https://stackoverflow.com') 
相關問題