创建firefox profile并用selenium1/selenium2启动

创建firefox profile并用selenium1/selenium2启动


注:转载自 http://blog.****.net/qiyueqinglian/article/details/43053531

创建firefox profile

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

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

创建firefox profile并用selenium1/selenium2启动

 

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

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

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

创建firefox profile并用selenium1/selenium2启动创建firefox profile并用selenium1/selenium2启动

创建firefox profile并用selenium1/selenium2启动

3 .点击完成按钮。

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


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

[java] view plain copy
  1. ProfilesIni ffxProfiles = new ProfilesIni();  
  2. FirefoxProfile webdriverProfile = ffxProfiles.getProfile("WebDriver_Profile");  
  3. WebDriver driver = new FirefoxDriver(webdriverProfile);