Selenium with Java、IntelliJ和Gradle-驱动程序可执行文件的路径必须由webdriver.gecko.driver系统属性设置
我正在尝试运行我的测试(cucumber、java、intelliJ),但我得到了以下异常线程:Selenium with Java、IntelliJ和Gradle-驱动程序可执行文件的路径必须由webdriver.gecko.driver系统属性设置,java,selenium,gradle,cucumber,Java,Selenium,Gradle,Cucumber,我正在尝试运行我的测试(cucumber、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 lat
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
我试着用这本书来学习:“黄瓜换Java书”
有些解释与当前版本无关,因此我遇到了一些麻烦。。。
但我希望你能帮助我
这是我的身材。格雷德尔:
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'
}
System.setProperty(“webdriver.gecko.driver”,pathToYourFirefoxExecutable) 你把壁虎放在哪里了?waht是位置?C:\Users\..\Documents\geckodriver-v0.23.0-win64\geckodriver.exe,它位于系统变量路径中。在实例化驱动程序之前。除此之外,没关系。好的,谢谢。我试过了,但还是不行:(