Selenium服务器无法启动自定义firefox配置文件

9ik*_*han 7 firefox selenium webdriver selenium-server

我试图通过将自定义firefox配置文件传递给DefaultSelenium构造函数来启动selenium服务器.它使用指定的URL打开浏览器.

DefaultSelenium selenium = new DefaultSelenium("localhost", 4444, "*custom \"C:/Program Files/Mozilla Firefox/firefox.exe\"",ReadConFile.readcoFile("serverName"));
    selenium.start();
Run Code Online (Sandbox Code Playgroud)

日志是

16:39:19.246 INFO - Allocated session 4eb63d37a4ba4d2fb4e351f8f59e3ea6 for https://<myURL>, launching...
Run Code Online (Sandbox Code Playgroud)

那就像那样,服务器无法启动.

但是,如果我不使用自定义配置文件,这可以正常工作.

DefaultSelenium selenium = new DefaultSelenium("localhost", 4444, "*chrome",ReadConFile.readcoFile("serverName"));
selenium.start();
Run Code Online (Sandbox Code Playgroud)

我需要启动自定义配置文件,因为我已经保存了https所需的一些站点证书.另外,我是从eclipse执行的.

我认为我的服务器未配置为启动自定义配置文件.请帮我解决一下这个.

Nat*_*tie 6

启动的命令是不是真的开始您的硒服务器本身,它是你的硒对象连接到一个已经运行的服务器与您所选择的浏览器.

要实际启动通过指定浏览器向测试中的应用程序发送/接收命令的selenium [Jetty Web]服务器,请使用批处理文件和rs79指的开关.批处理文件的内容应包括他的行:

java -jar selenium-server-standalone-2.0a5.jar -firefoxProfileTemplate C:\custom-firefox-profile
Run Code Online (Sandbox Code Playgroud)

现在,你的dev机器(localhost)上运行了一个真正的selenium服务器,默认的"4444"端口.这将指定任何Firefox浏览器测试都将使用此配置文件.

现在,您的DefaultSelenium构造函数,赋值和其他调用可能如下所示:

DefaultSelenium selenium = new DefaultSelenium("localhost", 4444, "*firefox","http://www.server.com");
selenium.start()
selenium.open("myApp/")
Run Code Online (Sandbox Code Playgroud)

Firefox将开始使用启动Selenium服务器的批处理文件中指定的自定义配置文件,使用所需的基本URL,然后导航到所需的应用程序[URL].如果您从" http://www.server.com/ " 开始测试而不是" http://www.server.com/myApp ",则可以省略最后一个打开的行.