Geb - IncompatibleClassChangeError [英] Geb - IncompatibleClassChangeError
问题描述
I'm just starting out with Geb and am encountering this error when inputting sample code from the Book of Geb:
我刚刚开始使用Geb,并在从Geb Book输入示例代码时遇到此错误。 import geb.Browser
Browser.drive {
gohttp://google.com/ncr
//确保我们确实转到页面
assert title ==Google
//在搜索栏输入wikipedia
$(input,name:q)。value wikipedia)
//等待结果页发生变化
//(google无需新请求即可动态更新页面)
waitFor {title.endsWith( Google Search)}
//是维基百科的第一个链接?
def firstLink = $(li.g,0).find(al)
assert firstLink.text()==Wikipedia
//点击链接
firstLink.click()
//等待Google的javascript重定向到Wikipedia
waitFor {title ==Wikipedia}
}
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" }
}
我遇到这个异常:
I am encountering this exception:
Caught: java.lang.IncompatibleClassChangeError: the number of constructors during runtime and compile time for java.lang.Exception do not match. Expected 4 but got 5
at geb.error.GebException.<init>(GebException.groovy:20)
at geb.waiting.WaitTimeoutException.<init>(WaitTimeoutException.groovy:30)
at geb.waiting.Wait.waitFor(Wait.groovy:108)
.......
有什么想法?谢谢!
推荐答案
您是否正在使用Java 7?使用<<编译的异常的Groovy代码Java 7与Java 7不兼容。
Are you using Java 7 by any chance? Groovy code that uses exceptions that was compiled with < Java 7 is not compatible with Java 7.
这篇关于Geb - IncompatibleClassChangeError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!