Eclipse中的Firefox的Selenium 3.0.1 webdriver错误

时间:2016-12-08 05:21:35

标签: selenium-webdriver selenium-firefoxdriver

我正在使用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

2 个答案:

答案 0 :(得分:0)

如果合规级别是指Java版本,则必须将其设置为8.查看 v3.0.0-beta1 release notes,其中包含:

  • 最低java版本现为8 +

答案 1 :(得分:0)

我已经解决了上面的代码 “代码序列错误” 顺序必须如下

 WebDriver driver;
System.setProperty("webdriver.gecko.driver","/home/Rrrrr/Downloads/jars/geckodriver");

driver = new FirefoxDriver();