使用Firefox版本(53.0.3(32位))/ Selenium(selenium-java-3.4.0)。
Exception in thread "main" java.lang.IllegalStateException: The driver executable is a directory: F:\Selenium\GecKo
at com.google.common.base.Preconditions.checkState(Preconditions.java:518)
at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:138)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:131)
at org.openqa.selenium.firefox.GeckoDriverService.access$100(GeckoDriverService.java:41)
at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:115)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:330)
at org.openqa.selenium.firefox.FirefoxDriver.toExecutor(FirefoxDriver.java:207)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:108)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:104)
at Login.Login.main(Login.java:13)
答案 0 :(得分:1)
在设置系统属性时,我们需要提供驱动程序可执行文件的完整路径。
System.setproperty("webdriver.gecko.driver","F:\\Selenium\\GecKo.exe");