2
votes

I'm trying to run my scalatest suite on selenium grid.

I'm using selenium DSL, so I think the only option is to create new trait, similar to Firefox/Chrome traits:

trait RemoteFirefox extends WebBrowser with Driver{

  val capability = DesiredCapabilities.firefox()

  implicit val webDriver = new RemoteWebDriver(new URL("http://gridurl:4444/wd/hub"), capability)
}

I think it is at least partially working, as it connects to the grid, but timeouts afterwards, like it didn't send a single command:

selenium-grid log:

17:45:16.317 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, browserName=firefox, maxInstances=1, platform=LINUX}

17:45:24.732 WARN - session ext. key c1ed51ae-e241-4f0c-a4b4-5bb5c53cab74 has TIMED OUT due to client inactivity and will be released.

And same timeout is seen in 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

Any ideas?

Notes: I'm using Latest docker images of selenium-hub and firefox node- and grid is working fine when used with protractor.

1
In case someone is wondering how to add -timeout 0 to selenium-hub docker : -e SE_OPTS="-timeout 0"cvakiitho
To avoid all unnecessary selenium configuration, you may take a look at github.com/dimafeng/testcontainers-scala and here's an example of usage dimafeng.com/2016/08/01/testcontainers-seleniumdimafeng

1 Answers

1
votes

You have to set the 'timeout' param to 0 while you provide the command to launch the Selenium Grid Hub.

For eg. java -jar selenium-server-standalone-2.50.1.jar -role hub -port 4444 -timeout 0

Note: It didn't work for me when I used an older version of selenium standalone jar. But, I downloaded the latest version as of today which is 'selenium-server-standalone-2.50.1.jar' and it worked.

Source: https://github.com/SeleniumHQ/selenium/wiki/Grid2