一、firefox浏览器实例配置
1、启动用户配置文件管理器
重要:在启动用户配置文件管理器之前,Firefox必须完全关闭。
1)按
+ R(Windows XP 上:点击 Windows 的 按钮,选择 )。

2)在运行对话框中,输入:
firefox.exe -p
就会弹出用户配置文件管理器,如下图:

说明:
(1)default是本机器安装firefox后,默认的用户配置文件
比如我的用户配置文件为:C:Users用户名Application DataMozillaFirefoxProfiles56ktcqhd.default
(2)点击 Create Profile,可以新建自己配置文件, 比如为 跑selenium 脚本,专门配置一个实例
命名配置文件, 并且选择要放置的位置,比如, 我不放在默认位置, 则ChooseFolder,选择D:Program Filesseleniumff-profile

(3)配置完成后, 双击profile,(或者选中,然后点击StartFirefox按钮)浏览器当前就会按照这种配置启动,比如双击 selenium-profile

(4)上述(3)方式启动浏览器后, 下次浏览器就按照这个配置去打开(比如, 在默认的配置下收藏的标签, 在这里就找不到了)
快速切换用户配置方法,可以建 .bat文件 来执行
文件命令内容:
cd C:Users用户名AppDataLocalMozilla Firefox //firefox安装位置, 按照实际情况切换
firefox.exe -profile "C:Users用户名Application DataMozillaFirefoxProfiles56ktcqhd.default" -no-remote
firefox.exe -profile "C:Users用户名Application DataMozillaFirefoxProfiles56ktcqhd.default" -no-remote
这种方式启动后,再关闭,又回到原来默认配置
所以要修改成默认配置用户文件, 要到 “用户配置文件管理器”里去设置。
二、启动selenium RC
java -jar selenium-server-standalone-2.33.0.jar -port 4444 -firefoxProfileTemplate "path to the profile"
PS:
自定义自己的浏览器配置后, 在selenium2.0中, 采用新的profile方法:
File filepath=new File("D:\selenium-profile"); FirefoxProfile profile=new FirefoxProfile(filepath); WebDriver driver=new FirefoxDriver(profile);