gpt4 book ai didi

selenium-webdriver - 我如何真正使Geb与Grails 2.3.11一起使用?

转载 作者:行者123 更新时间:2023-12-02 15:17:02 25 4
gpt4 key购买 nike

前几天偶然发现了Geb。我正在使用Grails 2.3.11。我实际上如何正确安装Geb?我下载了jar文件并包含了它们,但是当我尝试运行代码时,在org.openqa.selenium.WebDriverException上收到ClassNotFoundException

如果这很重要,我正在使用IntelliJ IDEA。

图书馆
Libraries
Gebtest.groovy

package gebish
import geb.Browser
class Gebtest {
public static void main(String[] args) {
println "Hi!"
Browser.drive {
go "http://gebish.org"

assert title == "Geb - Very Groovy Browser Automation"
}
}
}

失误
Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriverException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:344)
at org.codehaus.groovy.runtime.callsite.CallSiteArray$1.run(CallSiteArray.java:65)
at org.codehaus.groovy.runtime.callsite.CallSiteArray$1.run(CallSiteArray.java:62)
at java.security.AccessController.doPrivileged(Native Method)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallStaticSite(CallSiteArray.java:62)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:159)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at gebish.Gebtest.main(Gebtest.groovy:6)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.WebDriverException
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 11 more

最佳答案

我还使用Grails 2.3.11并运行了GEB。已经有一段时间了,所以我不确定到底需要什么,但这是BuildConfig.groovy的某些部分,这些部分可能是相关的:

def gebVersion = "0.13.1"
def webdriverVersion = "2.53.1"

dependencies {
compile "org.codehaus.groovy:groovy-backports-compat23:2.4.13"
test "org.gebish:geb-spock:${gebVersion}"
test "org.seleniumhq.selenium:selenium-support:${webdriverVersion}"
test "org.seleniumhq.selenium:selenium-chrome-driver:${webdriverVersion}"
test "org.seleniumhq.selenium:selenium-firefox-driver:${webdriverVersion}"
test "org.seleniumhq.selenium:selenium-ie-driver:${webdriverVersion}"

test "org.spockframework:spock-grails-support:0.7-groovy-2.0"
}

plugins {
test(":spock:0.7") {
exclude "spock-grails-support"
}
test "org.grails.plugins:geb:${gebVersion}"
}

关于selenium-webdriver - 我如何真正使Geb与Grails 2.3.11一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54596067/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com