2016-03-08 78 views
0

我试图做一些测试,在我的应用程序,但硒我得到这个错误PlayFramework ScalaTest测试网页与硒

[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]

这是我的代码

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" } 
    } 
    } 

} 
+0

您使用的是哪个版本的Play?哪个版本的jquery? – marcospereira

+0

我使用play 2.4.X和jquery 2.1.4 – Bartuken

回答

0

有当问题使用Play 2.4.x和jQuery 2.1.4运行HtmlUnit测试。更具体地说,HtmlUnit 2.18和jQuery 2.1.4或更高版本存在问题。这是报告如下:

https://github.com/playframework/playframework/issues/5050

后来,固定播放2.5.0这里:

https://github.com/playframework/playframework/pull/5786

在这里:

https://github.com/playframework/scalatestplus-play/pull/40

后者可用在scalatestplus-play 1.5.0。最简单的解决方法是版本的HtmlUnit手动升级到2.20:

libraryDependencies += "net.sourceforge.htmlunit" % "htmlunit" % "2.20" 

或者,当然了,你可以migrate your application to Play 2.5.0已经采用的的HtmlUnit的更新版本。

+0

Thx!我会更新我的框架。这是更好的解决方案。 – Bartuken