【发布时间】:2016-05-10 07:47:03
【问题描述】:
我正在尝试在 selenium 网格上运行我的 scalatest 套件。
我正在使用 selenium DSL,所以我认为唯一的选择是创建新的 trait,类似于 Firefox/Chrome 的特征:
trait RemoteFirefox extends WebBrowser with Driver{
val capability = DesiredCapabilities.firefox()
implicit val webDriver = new RemoteWebDriver(new URL("http://gridurl:4444/wd/hub"), capability)
}
我认为它至少部分工作,因为它连接到网格,但之后超时,就像它没有发送单个命令一样:
硒网格日志:
17:45:16.317 信息 - 尝试在测试槽上创建新会话 {seleniumProtocol=WebDriver, browserName=firefox, maxInstances=1, 平台=LINUX}
17:45:24.732 警告 - 会话分机。钥匙 c1ed51ae-e241-4f0c-a4b4-5bb5c53cab74 由于客户端已超时 不活动,将被释放。
在 sbt 中也看到了同样的超时
Session [c1ed51ae-e241-4f0c-a4b4-5bb5c53cab74] was terminated due to
TIMEOUT
Command duration or timeout: 121 milliseconds
Build info: version: '2.50.0', revision: '1070ace4650453d518aeb03e7a9a36c9d264a8e7', time: '2016-01-27 10:46:18'
System info: host:java.version: '1.8.0_25'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=44.0, platform=LINUX, nativeEvents=false, acceptSslCerts=true, webdriver.remote.sessionid=c1ed51ae-e241-4f0c-a4b4-5bb5c53cab74, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: c1ed51ae-e241-4f0c-a4b4-5bb5c53cab74
org.openqa.selenium.WebDriverException: Session [c1ed51ae-e241-4f0c-a4b4-5bb5c53cab74] was terminated due to TIMEOUT
Command duration or timeout: 121 milliseconds
有什么想法吗?
注意:我正在使用 selenium-hub 和 firefox 节点的最新 docker 图像,当与量角器一起使用时,网格工作正常。
【问题讨论】:
-
如果有人想知道如何将 -timeout 0 添加到 selenium-hub docker : -e SE_OPTS="-timeout 0"
-
为避免所有不必要的 selenium 配置,您可以查看github.com/dimafeng/testcontainers-scala,这是一个使用示例dimafeng.com/2016/08/01/testcontainers-selenium