[Java教程]The path to the driver executable must be set by the webdriver.gecko.driver system property

2016-09-06 16:00:10
0

报这个错,是因为你使用了selenium3+Firefox。在selenium3中,使用Firefox,需要添加驱动。

您可以从Github上下载驱动程序下载网址-  https://github.com/mozilla/geckodriver/releases/tag/v0.9.0

The path to the driver executable must be set by the webdriver.gecko.driver system property

 

在代码中加入

System.setProperty("webdriver.firefox.marionette","C:\\Program Files (x86)\\Mozilla Firefox\\geckodriver.exe");
WebDriver driver=new FirefoxDriver();

C:\\Program Files (x86)\\Mozilla Firefox\\geckodriver.exe是驱动放置的位置

现在,您可以运行程序,你会得到期望的输出。

相关文章:

  • 2021-11-25
  • 2021-12-07
  • 2022-12-23
  • 2021-09-04
  • 2021-06-30
  • 2021-08-10
猜你喜欢
  • 2022-12-23
  • 2021-08-19
  • 2022-12-23
  • 2022-12-23
  • 2021-07-30
相关资源
相似解决方案