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

報這個錯,是由於你使用了selenium3+Firefox。在selenium3中,使用Firefox,須要添加驅動。git

您能夠從Github上下載驅動程序下載網址-  https://github.com/mozilla/geckodriver/releases/tag/v0.9.0github

 

在代碼中加入web

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

C:\\Program Files (x86)\\Mozilla Firefox\\geckodriver.exe是驅動放置的位置firefox

如今,您能夠運行程序,你會獲得指望的輸出。blog

相關文章
相關標籤/搜索