我有以下设置:
- 安装 JDK & JRE 6u29
- 安装硒独立2.8
- Groovy 1.8.3
- 盖布 0.6.1
我只使用 GroovyConsole 尝试执行 Geb 手册中给出的第一个示例:
import geb.Browser
Browser.drive {
go "http://google.com/ncr"
// make sure we actually got to the page
assert title == "Google"
// enter wikipedia into the search field
$("input", name: "q").value("wikipedia")
// wait for the change to results page to happen
// (google updates the page dynamically without a new request)
waitFor { title.endsWith("Google Search") }
// is the first link to wikipedia?
def firstLink = $("li.g", 0).find("a.l")
assert firstLink.text() == "Wikipedia"
// click the link
firstLink.click()
// wait for Google's javascript to redirect to Wikipedia
waitFor { title == "Wikipedia" }
}
但我收到以下错误:
警告:清理堆栈跟踪:
geb.waiting.WaitTimeoutException:条件未在 5.0 秒内通过
这个例子有什么问题吗?我做错了什么吗?看到第一个示例甚至无法运行,这非常令人沮丧!