2016-06-07 40 views
0

我試圖測試Web應用程序,遊戲框架2.5,與PlaySpec和FluentLenium 下面是測試登錄頁面代碼:測試與PlaySpec和FluentLenium

import play.api.test._ 
import play.api.test.Helpers._ 

import org.scalatestplus.play.PlaySpec 

import org.scalatestplus.play._ 

class IntegrationSpec extends PlaySpec { 

    "My Application" should { 
     "work within a browser" in { 
      running(TestServer(3333), HTMLUNIT) { browser => 
       browser.goTo("http://localhost:3333") 
       browser.title mustBe "My Application" 

       browser.$("label").first.getText() must equal ("Login") 
       browser.$("label", 1).getText() must equal ("Password") 
       browser.fill("input").with("myLogin","myPassword") 
       //submit("#submit") 
      } 
     } 
    } 
} 

我有一個編譯錯誤顯示:

identifier expected but 'with' found. 

    browser.fill("input").with("myLogin","myPassword") 

回答

0

我想說我可能以前在某些Scala代碼中看到過,因爲它是關鍵字。在這種情況下,我認爲圍繞這​​個詞在反引號如

`with` 

解決了這個問題。不知道這是否有助於你。