创建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);