I'm trying to make some test with selenium in my app but I get this error
[error] - com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter - runtimeError: message=[An invalid or illegal selector was specified (selector: ':checked' error: Invalid selector: *:checked).] sourceName=[ http://localhost:9001/assets/javascripts/../lib/jquery/jquery.js] line=[1206] lineSource=[null] lineOffset=[0]
This is my code
class CheckPage extends PlaySpec with OneServerPerSuite with OneBrowserPerSuite with HtmlUnitFactory {
implicit override lazy val app: FakeApplication =
FakeApplication(
additionalConfiguration = Map("ehcacheplugin" -> "disabled")
)
implicit override lazy val port = 9001
"The OneBrowserPerTest trait" must {
"provide a web driver" in {
go to (s"http://localhost:$port/login")
pageTitle mustBe "Archacrom"
eventually { pageTitle mustBe "scalatest" }
}
}
}
There is a problem when running HtmlUnit tests with Play 2.4.x and jQuery 2.1.4. More specifically, there is a problem with HtmlUnit 2.18 and jQuery 2.1.4 or bigger. This was reported here:
https://github.com/playframework/playframework/issues/5050
And later, fixed for Play 2.5.0 here:
https://github.com/playframework/playframework/pull/5786
And here:
https://github.com/playframework/scalatestplus-play/pull/40
The later is available at scalatestplus-play 1.5.0. The easiest fix is to manually upgrade HtmlUnit version to 2.20:
libraryDependencies += "net.sourceforge.htmlunit" % "htmlunit" % "2.20"
Or, of course, you can migrate your application to Play 2.5.0 which already uses the updated version of HtmlUnit.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.