为什么我的 Geb 测试返回“无法从回调创建驱动程序"?即使在 Grails 中更新了我的 Selenium 依赖项之后? [英] Why does my Geb test return "failed to create driver from callback" even after updating my Selenium dependency in Grails?
问题描述
我正在引用这个以前的线程(geb.driver.DriverCreationException: 无法从回调创建驱动程序) - 但仍然有问题.
I am referencing this previous thread (geb.driver.DriverCreationException: failed to create driver from callback) - but am still having problems.
我正在尝试在 Grails 2.4.3 下运行 Geb 功能测试,并且我的 Selenium 支持依赖项设置为 2.42.2 版.我也用 2.43.1 和 2.45.0 试过了.如果我尝试使用 Selenium 2.42.2 或 2.43.1,Geb 将停止运行并且无法完成,如果我使用 2.45.0,它会彻底崩溃.
I am trying to run Geb functional tests under Grails 2.4.3 and I have my Selenium support dependency set to version 2.42.2. I've also tried it with 2.43.1 and 2.45.0. Geb will stall out and not finish if I try Selenium 2.42.2 or 2.43.1, and it will outright crash if I use 2.45.0.
这些是我得到的错误:
如果我尝试使用 Selenium 支持 2.42.2 或 2.43.1,我会收到此错误:geb.driver.DriverCreationException:无法从回调创建驱动程序
If I try Selenium support 2.42.2 or 2.43.1, I get this error: geb.driver.DriverCreationException: failed to create driver from callback
如果我尝试使用 Selenium 支持 2.45.0 - 我的浏览器将尝试运行 Geb 测试,但会返回页面未正确重定向"错误.
If I try Selenium support 2.45.0 - My browser will try to run the Geb test but will return a "The Page Is Not Redirectly Properly" error.
在我的 Grails BuildConfig.groovy 中,这是我现在设置的 selenium 依赖项:
In my Grails BuildConfig.groovy, here is the selenium dependency as I have it set right now:
def seleniumVersion = "2.45.0"
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
// runtime 'mysql:mysql-connector-java:5.1.29'
// runtime 'org.postgresql:postgresql:9.3-1101-jdbc41'
compile 'org.dbunit:dbunit:2.5.0'
test "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
test "org.gebish:geb-spock:$gebVersion"
compile "org.springframework:spring-orm:4.0.5.RELEASE"
// need for select objects
test "org.seleniumhq.selenium:selenium-support:2.45.0"
}
推荐答案
我让 Geb 使用以下属性:
I have Geb working with the following properties:
gebVersion = '0.10.0'
seleniumVersion = '2.43.1'
对于一些额外的信息,我有一个仅用于运行 Geb 测试的 Gradle 项目,这是我的 build.gradle
文件中的 Geb 特定数据.我知道这些版本可以一起使用,希望它们对您有用.
For a little extra info, I have a Gradle project that is only used to run Geb tests, and this is the Geb specific data in my build.gradle
file. I know these versions will work together, hopefully they can be of use to you.
ext {
// The drivers we want to use
drivers = ["firefox", "chrome", "phantomJs"]
ext {
groovyVersion = '2.3.6'
gebVersion = '0.10.0'
seleniumVersion = '2.43.1'
chromeDriverVersion = '2.10'
phantomJsVersion = '1.9.7'
}
}
dependencies {
// If using Spock, need to depend on geb-spock
testCompile "org.gebish:geb-spock:$gebVersion"
testCompile("org.spockframework:spock-core:0.7-groovy-2.0") {
exclude group: "org.codehaus.groovy"
}
testCompile "org.codehaus.groovy:groovy-all:$groovyVersion"
// Drivers
testCompile "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion"
testCompile "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
testCompile("com.github.detro.ghostdriver:phantomjsdriver:1.1.0") {
// phantomjs driver pulls in a different selenium version
transitive = false
}
}
这篇关于为什么我的 Geb 测试返回“无法从回调创建驱动程序"?即使在 Grails 中更新了我的 Selenium 依赖项之后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!