作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图告诉Selenium
的org.openqa.selenium.firefox.FirefoxDriver
使用现有的配置文件及其cookies和代理设置,所以我我正在做:
FirefoxProfile firefoxProfile = new FirefoxProfile(new File("C:\\Users\\name\\AppData\\Local\\Mozilla\\Firefox\\Profiles\\u72231ej.other"));
WebDriver driver = new FirefoxDriver(firefoxProfile);
但似乎无论如何都会创建一个新的配置文件。
最佳答案
FirefoxProfile ffprofile = new FirefoxProfile();
ffprofile.setPreference(); //Set your preference here
FirefoxDriver driver = new FirefoxDriver(ffprofile);
您可以通过在 Firefox 地址栏中输入 about:config 来获取首选项列表。新驱动程序将有一个配置文件,其中应用了您的设置。
关于java - 如何让 FirefoxDriver 使用现有的配置文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7771592/
我是一名优秀的程序员,十分优秀!