用户创建firefox配置文件

1.打开cmd进放 firefox.exe所在的目录 如:D:\>cd D:\Mozilla Firefox

2.运行如命令:D:\Mozilla Firefox>firefox.exe -ProfileManager -no-remote。出现如图

3.点击创建配置文件

4.刚创建的文件里面只有少部分内容,还要自己去配置

5.打开记事本,“开始”->“附件”->“记事本”

6.在记事本里输入:

set MOZ_NO_REMOTE=1
start "" "C:\Program Files\Mozilla Firefox Formal\firefox.exe" -P seo

说明: C:\Program Files\Mozilla Firefox Formal\firefox.exe是路径;-P后面的文字是你创建的配置文件的名称

7.把文件保存在任何一个位置,命名为“firefoxSEO.bat” ,双击“firefoxSEO.bat”,你就启动“seo”配置文件的Firefox了。

8.最后,在代码中使用如下方式启动FirefoxDriver:

  1. ProfilesIni allProfiles = new ProfilesIni();  
  2. // "Selenium" is the new profile just created  
  3. FirefoxProfile profile = allProfiles.getProfile("Selenium");  
  4. WebDriver driver = new FirefoxDriver(profile);  
  5. (另外我们可以看到Manager里面有个default,这个就是我们自己平时使用的Firefox Profile,也是可以在代码中使用的)

 

转载于:https://www.cnblogs.com/wangyonglong/p/5182477.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值