@Grapes([
@Grab("org.gebish:geb-core:0.9.0"),
@Grab("org.gebish:geb-spock:0.9.0"),
@Grab("org.seleniumhq.selenium:selenium-firefox-driver:2.33.0"),
@Grab("org.seleniumhq.selenium:selenium-chrome-driver:2.33.0"),
@Grab("org.seleniumhq.selenium:selenium-support:2.26.0"),
@Grab( group='org.spockframework',
module='spock-core',
version='0.3'
),
@Grab(group='org.gebish', module='geb-implicit-assertions', version='0.9.0')
])
import geb.Browser
import geb.spock.GebReportingSpec
import org.openqa.selenium.chrome.*
import spock.lang.Specification
import geb.navigator.NonEmptyNavigator
import geb.navigator.factory.*
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver\\chromedriver.exe");
def browser = new Browser(driver: new ChromeDriver())
browser.go "http://www.google.com/"
assert browser.title == "Google"
browser.$("input", name: "q").value("query")
当我尝试运行上述代码时,出现以下错误
WARNING: Sanitizing stacktrace:
java.lang.NoClassDefFoundError: Could not initialize class geb.navigator.NonEmptyNavigator
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
at geb.navigator.factory.DefaultInnerNavigatorFactory.class$(DefaultInnerNavigatorFactory.groovy)
at geb.navigator.factory.DefaultInnerNavigatorFactory.$get$$class$geb$navigator$NonEmptyNavigator(DefaultInnerNavigatorFactory.groovy)
at geb.navigator.factory.DefaultInnerNavigatorFactory.createNavigator(DefaultInnerNavigatorFactory.groovy:40)
at geb.navigator.factory.InnerNavigatorFactory$createNavigator.call(Unknown Source)
at geb.navigator.factory.AbstractNavigatorFactory.createFromWebElements(AbstractNavigatorFactory.groovy:44)
at geb.navigator.factory.NavigatorFactory$createFromWebElements.callCurrent(Unknown Source)
at geb.navigator.factory.BrowserBackedNavigatorFactory.getBase(BrowserBackedNavigatorFactory.groovy:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1671)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3408)
at geb.navigator.factory.AbstractNavigatorFactory.getProperty(AbstractNavigatorFactory.groovy)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227)
at geb.content.NavigableSupport.getNavigator(NavigableSupport.groovy:39)
at geb.content.NavigableSupport.$(NavigableSupport.groovy:96)
at geb.content.NavigableSupport$$.call(Unknown Source)
at geb.Page.$(Page.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1085)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:848)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:831)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:164)
at geb.Browser.methodMissing(Browser.groovy:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:837)
关于如何解决它的任何想法???