首页 > 其他 > 详细

selenium启动firefox时加载扩展

时间:2015-01-07 16:23:08      阅读:168      评论:0      收藏:0      [点我收藏+]

    有些时候,我们测试需要用到插件或者已经导入的证书(比如金融和安全加密行业),而selenium启动firefox时会打开一个新的,不含有任何插件和个人证书的firefox(等同于全新安装后第一次打开的那个firefox)这种情况下,我们就要用firefoxprofile了。

    我们需要先新建一个profile或者直接使用默认,最快捷的方法就是把默认的profile拷贝一份出来。

关于firefox的profile,官网有介绍,点击这里查看

    使用特定Profile启动,使用FirefoxDriver(FirefoxProfile profile)的构造方法。

1 FirefoxProfile profiles = new FirefoxProfile(newFile("C:\\FirefoxProfile\\Auto"));  
2 WebDriver webDriver = new FirefoxDriver(profiles);  

    这样启动firefox后就会加载插件或证书了。

selenium启动firefox时加载扩展

原文:http://www.cnblogs.com/liu-ke/p/4208514.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!