2011-07-06 30 views
1

我試圖在遠程計算機上啓動自定義的Firefox配置文件,從Windows XP啓動到Mac OS X.瀏覽器使用自定義配置文件啓動,但打開了設置網址和遠程運行在同一個URL路徑上(實際上測試不運行)。Selenium在遠程計算機Mac OS上啓動自定義配置文件

設置:

selenium = new DefaultSelenium(setup.host, setup.port, setup.browser, setup.url); 
    selenium.start(); 

拉這樣的:

static String host = "192.168.224.49"; 
    static int port  = 4444; 
    static String browser = "*custom"+" "+"//Applications//Firefox.app//Contents//MacOS/firefox-bin"+" "+"-P"+" "+"Selenium"; 
    static String url  = "http://test.Example.com"; 

打開瀏覽器並使用正確的配置文件,但不正確加載的URL。

任何幫助將不勝感激!

回答

1

要使用customProfile啓動firefox,您不需要將其作爲自定義瀏覽器打開。您應該在啓動服務器時設置firefoxprofileTemplate。

如果您正在使用Java的罐子硒-server命令開始從命令提示符罐子,那麼你應該使用以下命令:

java -jar selenium-server -firefoxProfileTemplate <path to firefox template> 

如果使用代碼啓動服務器,那麼你應該使用下面的代碼:

SeleniumServer selServer; 
RemoteControlConfiguration rc; 
rc.setFirefoxProfileTemplate(File which refers to FirefoxProfileTemplate) 
selServer=new SeleniumServer(false,rc); 

對於這兩個,你應該首先使用firefox -P命令創建firefox配置文件。

+0

當我這樣做時,我得到一個無效的路徑錯誤,雖然它使用相同的路徑作爲*自定義。你可以使用* firefox選項,然後使用自定義配置文件路徑嗎? – Armando

+0

* firefox曾爲我工作過。你如何開始你的硒服務器? –

+0

@BeforeClass \t \t公共無效設定()拋出異常{ \t \t \t \t \t \t SeleniumServer seleniumServer = NULL; \t \t \t嘗試{ \t \t \t \t \t seleniumServer =新SeleniumServer(); \t \t \t \t \t seleniumServer.start(); \t \t \t \t}趕上(例外五){ \t \t \t \t \t e.printStackTrace(); \t \t } \t \t \t \t 硒=新DefaultSelenium(setup.host,setup.port,setup.browser,setup.url); \t selenium.start(); \t} – Armando

相關問題