美文网首页学习笔记
python+webdriver解决插件启用问题

python+webdriver解决插件启用问题

作者: 蘑菇小巷 | 来源:发表于2017-08-14 09:55 被阅读50次

使用self.driver=webdriver.Firefox()会自动开启一个新的,不含有任何插件和个人证书的firefox(等同于全新安装后第一次打开的那个firefox)。这样会使我们系统需要用的一些插件不能使用,参考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.重新跑测试脚本,发现打开的就是平时自己用的相同配置的浏览器了

补充:firefoxprofile火狐的配置文件,官网描述如下

相关文章

网友评论

    本文标题:python+webdriver解决插件启用问题

    本文链接:https://www.haomeiwen.com/subject/sowyrxtx.html