Using Selenium in Scala play not only for testing

50 Views Asked by At

I try to build a testing API on top of the play framework. This API call a Selenium Grid not only in tests but also on the main program.

I have the following build.sbt :

import scala.language.postfixOps

ThisBuild / scalaVersion := "2.13.12"

ThisBuild / version := "1"

lazy val root = (project in file("."))
  .enablePlugins(PlayScala)
  .settings(
    name := """MarauderV2""",
    libraryDependencies ++= Seq(
      guice,
      "org.seleniumhq.selenium" % "selenium-java" % "4.8.1",
      "org.seleniumhq.selenium" % "selenium-remote-driver" % "4.8.1",
      "org.seleniumhq.selenium" % "selenium-chromium-driver" % "4.8.1",
      "org.seleniumhq.selenium" % "selenium-chrome-driver" % "4.8.1",
      "org.seleniumhq.selenium" % "selenium-api" % "4.8.1",
      "org.scalatestplus.play" %% "scalatestplus-play" % "5.1.0" % Test,
      specs2 % Test
    )
  )

The compilation is fine but I do not manage to compile my tests. As far as I understand there is a conflict between the version of Selenium used in the play framework for integration tests and the Selenium imported in the project.

I got the following error :

Class org.openqa.selenium.internal.FindsById not found - continuing with a stub.

And nothing more.

I have tried to set the % Compile after the import of the selenium library.

When I remove the Selenium parts, the tests are running correctly. The program by itself works just fine and access the selenium grid to perform the integration tests on another tool.

0

There are 0 best solutions below