Geb - IncompatibleClassChangeError

依然范特西╮ 提交于 2019-12-18 05:13:21

问题


I'm just starting out with Geb and am encountering this error when inputting sample code from the Book of 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" }
}

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)
        .......

Any ideas? Thanks!


回答1:


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.




回答2:


Geb is compatible with Java7 as of 0.7.1. If you are below that you should upgrade. SEe: http://jira.codehaus.org/browse/GEB-194



来源:https://stackoverflow.com/questions/7826967/geb-incompatibleclasschangeerror

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!