2011-07-06 33 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

相关问题