为什么我的Geb测试返回"无法从回调创建驱动程序"即使在Grails中更新我的Selenium依赖项后?

时间:2015-05-06 19:30:29

标签: java grails selenium groovy geb

我正在引用此前一个帖子(geb.driver.DriverCreationException: failed to create driver from callback) - 但我仍然遇到问题。

我正在尝试在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,它将彻底崩溃。

这些是我得到的错误:

  1. 如果我尝试使用Selenium支持2.42.2或2.43.1,我会收到此错误:geb.driver.DriverCreationException:无法从回调创建驱动程序

  2. 如果我尝试使用Selenium支持2.45.0 - 我的浏览器将尝试运行Geb测试,但会返回"页面不能正确地重复使用"错误。

  3. 在我的Grails BuildConfig.groovy中,这是我现在设置的硒依赖:

     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 个答案:

答案 0 :(得分:2)

我让Geb使用以下属性:

gebVersion = '0.10.0'
seleniumVersion = '2.43.1'

有一点额外的信息,我有一个Gradle项目,它只用于运行Geb测试,这是我build.gradle文件中的Geb特定数据。我知道这些版本可以协同工作,希望它们对您有用。

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
    }
}
相关问题