创建firefox profile并用selenium1/selenium2启动

创建firefox profile

1 . 打开运行窗口(开始->运行),输入 firefox.exe –p 回车。

或者进入dos命令窗口,进入firefox所在的路径,输入firefox -p


 

如果没有出现,可能是你已经打开了 firefox ,如果是请先关闭。

2 . 点击创建配置文件。然后单击下一步。输入profile的名字,例如webdriver_profile。

可以点击 选择文件夹,更改profile存放的路径。不过一般不用更改,默认的就行。



3 .点击完成按钮。

4 .选择刚才新建的profile,启动Firefox。对这个Firefox进行一些设置,比如安装插件等等。这样你在使用这个 profile 的时候就会有相应的插件。


用selenium2启动Firefox,应用刚才创建的profile

ProfilesIni ffxProfiles = new ProfilesIni();
FirefoxProfile webdriverProfile = ffxProfiles.getProfile("WebDriver_Profile");
WebDriver driver = new FirefoxDriver(webdriverProfile);



用selenium1启动firefox,应用刚才创建的profile

在 selenium 的 start.bat 文件中加入 -firefoxProfileTemplate "your firefox profile path" 


参照http://blog.csdn.net/andyhong110/article/details/5766925

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值