selenium启动firefox时加载扩展
生活随笔
收集整理的這篇文章主要介紹了
selenium启动firefox时加载扩展
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
? ? 有些時候,我們測試需要用到插件或者已經導入的證書(比如金融和安全加密行業),而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时加载扩展的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 修改linux命令符和解决命令符太长的问
- 下一篇: 小儿病毒性腮腺炎案