Selenium2默认情况下以新配置文件启动Firefox。我喜欢这种默认配置,但出于一些很好的原因(访问我的书签,保存的密码,使用我的加载项等)我想从我的默认配置文件开始。Selenium2 firefox:使用默认配置文件
有supposed to be一个属性控制这个,但我认为文档与源不同步,因为据我所知webdriver.firefox.bin
是唯一有效的。例如。启动硒:
java -jar selenium-server-standalone-2.5.0.jar -Dwebdriver.firefox.bin=not-there
工程(即它抱怨)。但这并没有影响:
java -jar selenium-server-standalone-2.5.0.jar -Dwebdriver.firefox.profile=default
(“默认”是profiles.ini的名字,但我也试图与“PROFILE0”,这是在profiles.ini节的名称)。
我使用PHPWebdriver(使用JsonWireProtocol)访问:
$webdriver = new WebDriver("localhost", "4444");
$webdriver->connect("firefox");
我尝试从PHP侧做:
$webdriver->connect("firefox","",array('profile'=>'default'));
或:
$webdriver->connect("firefox","",array('profile'=>'Profile0'));
与没有成功(Firefox启动,但没有使用我的配置文件)。
我也尝试创建一个批处理文件的黑客的做法:用
#!/bin/bash
/usr/bin/firefox -P default
然后开始硒: Java的罐子硒的服务器独立-2.5.0.jar -Dwebdriver.firefox.bin =“/ usr/local/src/selenium/myfirefox”
Firefox启动,但没有使用默认配置文件,更糟的是,一切都挂起:硒启动时似乎无法与firefox进行通信。
P.S.我看到Selenium - Custom Firefox profile我尝试这样做:
java -jar selenium-server-standalone-2.5.0.jar -firefoxProfileTemplate "not-there"
,拒不执行!兴奋,想着我可能会做点什么,我试过了:
java -jar selenium-server-standalone-2.5.0.jar -firefoxProfileTemplate /path/to/0abczyxw.default/
这没什么用。即它仍然:-(
谢谢,这真的很有帮助。如果PHP代码压缩配置文件然后编码为base64,那么这样做会很好,因此人们可以在PHP中执行所有操作。 – David
重新确认已经陈述的内容......这是要走的路。当我们想通过代理来管理所有的硒请求时,我们的工作完美无缺。 –