使用self.driver=webdriver.Firefox()會自動開啟一個新的,不含有任何插件和個人證書的firefox(等同于全新安裝后第一次打開的那個firefox)。這樣會使我們系統(tǒng)需要用的一些插件不能使用,參考http://www.tuicool.com/articles/NJv6Nj
文章中解決步驟:
1.查找Firefox frofiles路徑,在開始菜單的底部搜索框中輸入:
%APPDATA%\Mozilla\Firefox\Profiles\
2.將路徑添加到代碼中:
self.profileDir = "C:/Users/Administrator/AppData/Roaming/Mozilla/Firefox/Profiles/jj3dmu4i.default"
self.profile = webdriver.FirefoxProfile(self.profileDir)
self.driver = webdriver.Firefox(self.profile)
3.重新跑測試腳本,發(fā)現打開的就是平時自己用的相同配置的瀏覽器了
補充:firefoxprofile火狐的配置文件,官網描述如下