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
重新確認已經陳述的內容......這是要走的路。當我們想通過代理來管理所有的硒請求時,我們的工作完美無缺。 –