geb-gradle-saucelabs 集成的驱动程序错误

driver error for geb-gradle-saucelabs integration

我正尝试 运行 低于 build.gradle 与 saucelabs 集成。下面是GebConfig.groovy

import org.openqa.selenium.chrome.ChromeDriver
import geb.driver.SauceLabsDriverFactory
import geb.buildadapter.BuildAdapterFactory

//driver = { new ChromeDriver() }

def sauceBrowser = System.getProperty("geb.saucelabs.browser")
if (sauceBrowser) {
    driver = {
       def username = System.getenv("username")
       assert username
       def accessKey = System.getenv("accesskey")
       assert accessKey
       new SauceLabsDriverFactory().create(sauceBrowser, username, accessKey)
    }
}

我正在根据thisbuild.gradle中设置geb.saucelabs.browser道具。完整的 build.gradle 看起来像

apply plugin: "geb-saucelabs"

buildscript {
    repositories {
        jcenter()
    }    

    dependencies {
       classpath 'org.gebish:geb-gradle:0.13.1'
    }
}

apply plugin: 'java'
apply plugin: 'groovy'

repositories {

    mavenCentral()
    maven { url "http://repository-saucelabs.forge.cloudbees.com/release" }
}

dependencies {
           def seleniumVersion = '2.45.0'
           def phantomJsVersion = '1.1.0'
           def groovyVersion = '2.4.3'

    //groovy
    compile "org.codehaus.groovy:groovy-all:$groovyVersion"

    // selenium drivers
     testCompile "org.seleniumhq.selenium:selenium-ie-driver:$seleniumVersion"
     testCompile "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion"
     //testCompile "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
     testCompile "org.seleniumhq.selenium:selenium-support:$seleniumVersion"
     testRuntime "org.seleniumhq.selenium:selenium-support:$seleniumVersion"
     testCompile("com.github.detro.ghostdriver:phantomjsdriver:$phantomJsVersion") {
     transitive = false
    }

    // geb
    testCompile "org.gebish:geb-spock:0.10.0"

     // spock
    testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'

    //junit
    testCompile "org.gebish:geb-junit4:0.10.0"
    testCompile "junit:junit-dep:4.8.2"


    sauceConnect "com.saucelabs:sauce-connect:3.0.28"

        }

sauceLabs {
    browsers { 

       chrome_mac

    }
    task { 
       testClassesDir = test.testClassesDir
       testSrcDirs = test.testSrcDirs
       classpath = test.classpath
    }

    account { 
       username = System.getenv("username")
       accessKey = System.getenv("accessKey")
    }


}

test {

            System.setProperty("geb.saucelabs.browser ","browserName=firefox platform=LINUX version=19")
            systemProperties "geb.build.reportsDir": "$reportsDir/geb"
        }

但我收到错误消息,我认为驱动程序配置不正确,配置中缺少什么?

The path to the driver executable must be set by the webdriver.ie.driver system property;

您用来 运行 测试的命令是什么?您不应该为 test 任务摆弄 geb.saucelabs.browser 系统 属性,而是根据您 link 在您的问题中提供的文档使用 chromeMacTest 任务。

这已通过在 .profile.bash_profile 中设置 mac 环境变量解决

export SAUCE_USERNAME=username
export SAUCE_ACCESS_KEY-youraccesskey

在为两者添加引号之前