The path to the driver executable must be set by the webdriver.gecko.driver system property
Posted Halo3224
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了The path to the driver executable must be set by the webdriver.gecko.driver system property相关的知识,希望对你有一定的参考价值。
报这个错,是因为你使用了selenium3+Firefox。在selenium3中,使用Firefox,需要添加驱动。
您可以从Github上下载驱动程序下载网址- https://github.com/mozilla/geckodriver/releases/tag/v0.9.0
在代码中加入
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是驱动放置的位置
现在,您可以运行程序,你会得到期望的输出。
以上是关于The path to the driver executable must be set by the webdriver.gecko.driver system property的主要内容,如果未能解决你的问题,请参考以下文章