我正在使用Ubuntu 14并使用selenium 3.0安装了Eclipse的编译器合规级别1.7。如果我将级别降低到1.4,则会显示sendkey()
函数的错误。我设置了属性:
System.setProperty("webdriver.gecko.driver","/home/Rrrrr/Downloads/jars/geckodriver");
我使用以下代码:
WebDriver driver;
driver = new FirefoxDriver();
System.setProperty("webdriver.gecko.driver","/home/Rrrrr/Downloads/jars/geckodriver");
driver.get("http://www.google.com");
但它仍然给我以下错误。是版本问题还是其他任何问题?
Exception in thread "main" 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
答案 0 :(得分:0)
如果合规级别是指Java版本,则必须将其设置为8.查看 v3.0.0-beta1 的release notes,其中包含:
答案 1 :(得分:0)
我已经解决了上面的代码 “代码序列错误” 顺序必须如下
WebDriver driver;
System.setProperty("webdriver.gecko.driver","/home/Rrrrr/Downloads/jars/geckodriver");
driver = new FirefoxDriver();