[失败:无法联系 Selenium 服务器;你在 'localhost:4444' 上启动它了吗?阅读更多http://seleniumhq.org/projects/remote-control/not-started.html连接被拒绝]
嗨..我在easyB上工作并遇到上述问题如何启动selenium rc服务器以及这个问题是什么?
谢谢...
[失败:无法联系 Selenium 服务器;你在 'localhost:4444' 上启动它了吗?阅读更多http://seleniumhq.org/projects/remote-control/not-started.html连接被拒绝]
嗨..我在easyB上工作并遇到上述问题如何启动selenium rc服务器以及这个问题是什么?
谢谢...
好吧,您可以在 [your-webapp]/scripts/ _Events.groovy中编写一个 groovy 脚本来启动和停止 selenium(您必须先安装 selenium-rc 插件才能访问 seleniumConfig 或 selenium Server 脚本。)
includeTargets << new File("$seleniumRcPluginDir/scripts/_SeleniumConfig.groovy")
includeTargets << new File("$seleniumRcPluginDir/scripts/_SeleniumServer.groovy")
eventTestPhaseStart = { phase ->
if(isAcceptance(phase)){
startSeleniumServer()
}
}
eventTestPhaseEnd = { phase ->
if(isAcceptance(phase)){
stopSeleniumServer()
}
}
isAcceptance = { phase->
phase?.contains("acceptance");
}
您需要先启动 Selenium Server,然后才能使用客户端实例。
因此,在调用 defaultSelenium 实例创建之前,您可以使用 RemoteControlConfiguration(链接到 javadoc)对象启动服务器并将其用作 SeleniumServer 构造函数调用的参数,然后使用 serverinstance.boot() 调用启动服务器。
就像是
RemoteControlConfiguration rcc = new RemoteControlConfiguration()
//set whatever values you want your rc to start with:port,logoutfile,profile etc.
SeleniumServer ss = new SeleniumServer(rcc)
ss.boot()
确保在完成测试后将其关闭。