首页 > 其他 > 详细

用户创建firefox配置文件

时间:2016-02-05 01:28:34      阅读:120      评论:0      收藏:0      [点我收藏+]

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,也是可以在代码中使用的)

 

用户创建firefox配置文件

原文:http://www.cnblogs.com/wangyonglong/p/5182477.html

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