自从我使用 Firefox 升级到 3.0 beta 后,我就有了这个异常(exception)。
Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property
最佳答案
我们使用 System.setProperty 来提供 chromedriver/iedriver 等的路径。下面是 java.lang.System.setProperty() 方法的声明:
public static String setProperty(String key, String value)
关键 :系统属性的名称
值(value) :系统属性的值
例如
System.setProperty("webdriver.chrome.driver", "src/test/resources/chromedriver.exe");
webdriver.chrome.driver : Chrome 驱动程序(系统属性的名称)
src/test/resources/chromedriver.exe : chromedriver 的路径(系统属性的值)
通常,我们会遇到 IllegalArgumentException 当键为空时。
关于selenium - 在 System.setProperty ("webdriver.gecko.driver", "<Path to your WebDriver>")中, "Path to your WebDriver"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38873077/