问题
I am referencing this previous thread (geb.driver.DriverCreationException: failed to create driver from callback) - but am still having problems.
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.
These are the errors I get:
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
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.
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"
}
回答1:
I have Geb working with the following properties:
gebVersion = '0.10.0'
seleniumVersion = '2.43.1'
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
}
}
来源:https://stackoverflow.com/questions/30085879/why-does-my-geb-test-return-failed-to-create-driver-from-callback-even-after-u