2016-03-08 41 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