【发布时间】:2018-11-14 14:25:12
【问题描述】:
我正在尝试运行我的测试(黄瓜、java、intelliJ),但我得到了这个异常线程:
java.lang.IllegalStateException: The path to the driver executable must be
set by the webdriver.gecko.driver system property; for more information, see
https://github.com/mozilla/geckodriver. The latest version can be downloaded
from https://github.com/mozilla/geckodriver/releases
我正在使用 Selenium 3.141.5 和 Mozilla 63.0.1。
我试着用这本书来学习:“The Cucumber for Java Book” 有些解释与当前版本无关,因此我遇到了一些麻烦...... 但我希望你能帮助我
这是我的 build.gradle:
plugins {
id 'java'
}
group 'cucumber_cash_withdrawal'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile 'io.cucumber:cucumber-java:2.4.0'
testCompile 'io.cucumber:cucumber-junit:2.4.0'
testCompile group: 'info.cukes', name: 'cucumber-picocontainer', version: '1.2.5'
implementation group: 'org.eclipse.jetty', name: 'jetty-webapp', version: '9.4.12.v20180830'
implementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.141.5'
}
configurations {
cucumberRuntime {
extendsFrom testRuntime
}
}
task cucumber() {
dependsOn assemble, compileTestJava
doLast {
javaexec {
main = "cucumber.api.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = ['--plugin', 'pretty', '--glue', 'gradle.cucumber', 'src/test/resources']
}
}
}
apply plugin: 'java'
task runApp(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'cash_withdrawal.AtmServer'
}
【问题讨论】:
-
你把 geckodriver 放在哪里了?地点在哪里?
-
C:\Users\..\Documents\geckodriver-v0.23.0-win64\geckodriver.exe 位于系统变量PATH中。
标签: java selenium gradle cucumber