我正在尝试在远程计算机上启动自定义 Firefox 配置文件,从 Windows XP 启动到 Mac OS X。浏览器使用自定义配置文件启动,但在同一 URL 路径上打开设置 URL 和远程运行程序(本质上测试不会运行)。
设置:
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。
任何帮助将不胜感激!
最佳答案
要使用自定义配置文件启动 Firefox,您无需将其作为自定义浏览器打开。您应该在启动服务器时设置 firefoxprofileTemplate。
如果您使用 java -jar selenium-server 命令从命令提示符启动 jar,那么您应该使用以下命令:
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 配置文件。
关于java - Selenium 在远程计算机 Mac OS 上启动自定义配置文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6598889/