Selenium with Scala Test 3.0.5.

10 views
Skip to first unread message

Manoj Waikar

unread,
Jun 10, 2019, 10:03:56 PM6/10/19
to scalatest-users
Hi,

There is a previous question on this group as to which version of Selenium is compatible with Scala Test 3.0.1?
Based on the reply to that question (mentioning the location of POM file), it looks like that Scala Test 3.0.5 uses selenium-java 2.45.0

However, the Scala test website suggests using 2.35.0.

My code uses the following base classes -

class BaseUISpec extends WordSpec with Matchers with BeforeAndAfterAll {
 val logger
= Logger(this.getClass)

 val homePageUrl
: String = Configuration.getUrl("") + "/"
 logger
.info(s"home page url: $homePageUrl")
}

class HtmlUnitSpec extends BaseUISpec with HtmlUnit with Eventually with IntegrationPatience {

 
override protected def beforeAll(): Unit = {
  go to homePageUrl
 
}

 
override protected def afterAll(): Unit = {
  close
()
 
}
}



Also, when I try to run a basic test, I get the following exception -

 com.intercax.syndeia.ui.LoginSpec *** ABORTED ***
   java
.lang.NoClassDefFoundError: org/openqa/selenium/remote/SessionNotFoundException
   at org
.scalatest.selenium.HtmlUnit.$init$(WebBrowser.scala:4477)
   at com
.intercax.syndeia.ui.HtmlUnitSpec.<init>(BaseUISpec.scala:19)
   at com
.intercax.syndeia.ui.LoginSpec.<init>(LoginSpec.scala:10)
   at sun
.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun
.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
   at sun
.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   at java
.lang.reflect.Constructor.newInstance(Constructor.java:423)
   at java
.lang.Class.newInstance(Class.java:442)
   at org
.scalatest.tools.Framework$ScalaTestTask.execute(Framework.scala:435)
   at sbt
.TestRunner.runTest$1(TestFramework.scala:113)
   
...
   
Cause: java.lang.ClassNotFoundException: org.openqa.selenium.remote.SessionNotFoundException
   at java
.net.URLClassLoader.findClass(URLClassLoader.java:382)
   at java
.lang.ClassLoader.loadClass(ClassLoader.java:424)
   at java
.lang.ClassLoader.loadClass(ClassLoader.java:357)
   at org
.scalatest.selenium.HtmlUnit.$init$(WebBrowser.scala:4477)
   at com
.intercax.syndeia.ui.HtmlUnitSpec.<init>(BaseUISpec.scala:19)
   at com
.intercax.syndeia.ui.LoginSpec.<init>(LoginSpec.scala:10)
   at sun
.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun
.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
   at sun
.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   at java
.lang.reflect.Constructor.newInstance(Constructor.java:423)

Now a simple "hello world" Java example using HtmlUnit driver works fine.

Are there any plans to upgrade to latest version of selenium i.e. 3.141.59?

Thanks,
Manoj.

Reply all
Reply to author
Forward
0 new messages