我正在尝试使用PlaySpec和FluentLenium测试web应用程序Play Framework2.5,下面是用于测试登录页面的代码:
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")发布于 2016-07-07 07:17:47
我想说,我以前可能在一些Scala代码中看到过这种情况,因为with是一个关键字。在这种情况下,我认为用反引号将单词括起来,比如
`with`解决了这个问题。不确定这对你有没有帮助。
https://stackoverflow.com/questions/37672634
复制相似问题