raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a
matching set of capabilities
selenium3.0之后的版本的就不支持直接打開火狐瀏覽器,啟動火狐瀏覽器報錯,如下圖,要想運行就需要我們單獨裝上驅動。
3.0之前的版本,是可以直接打開火狐瀏覽器的。火狐版本不兼容,需下載對應的驅動器,
IE驅動是可以的
#coding=utf-8
from selenium import webdriver
import time
driver=webdriver.Ie(executable_path="C:\\Program Files\\Mozilla Firefox\\IEDriverServer")
time.sleep(3)
driver.get("https://baidu.com.cn")
driver.quit()
解決辦法:
1、首先下載最新版的火狐瀏覽器
2、下載合適的驅動,對應自己系統,下載地址https://github.com/mozilla/geckodriver/releases,解壓文件把下載的驅動文件放在自己的驅動目錄下邊,我放在單獨一個d盤的D:\driver目錄下.
重新運行腳本即可。
各個瀏覽器驅動與瀏覽器版本的映射關系見:http://blog.csdn.net/huilan_same/article/details/52615123
注火狐瀏覽器的版本與驅動版本映射關系沒有