有些时候,我们测试需要用到插件或者已经导入的证书(比如金融和安全加密行业),而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后就会加载插件或证书了。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有