【问题标题】:Running scalatest on selenium grid在硒网格上运行 scalatest
【发布时间】: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 图像,当与量角器一起使用时,网格工作正常。

【问题讨论】:

标签: scala selenium scalatest


【解决方案1】:

在提供启动 Selenium Grid Hub 的命令时,您必须将 'timeout' 参数设置为 0

例如。 java -jar selenium-server-standalone-2.50.1.jar -role hub -port 4444 -timeout 0

注意:当我使用旧版本的 selenium 独立 jar 时,它对我不起作用。但是,我下载了截至今天的最新版本,即“selenium-server-standalone-2.50.1.jar”并且它工作正常。

来源https://github.com/SeleniumHQ/selenium/wiki/Grid2

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-29
    • 2018-05-17
    • 1970-01-01
    • 2015-08-08
    相关资源
    最近更新 更多