The path to the driver executable must is set by the Webdriver.gecko.driver system property;

Source: Internet
Author: User
Tags session id

After installing Webdriver today, a test applet was written, but the runtime console reported the error:

1 The path to the driver executable must is set by the Webdriver.gecko.driver system property;  For more information, see https://https://github.com/mozilla/geckodriver/releases 

Resolution process:

1, check a bit, it is said that the error is because in selenium3, the use of Firefox needs to add drivers. So from the night to find the driver:

Download URL 1:http://download.csdn.net/detail/just_h_mao/9670229

Download URL 2:https://github.com/mozilla/geckodriver/releases/tag/v0.9.0

2.

Note: If you use a non-default installation path when installing Firefox, you can not find Firefox.exe to start the Firefox browser that executes this script. Set the browser installation path before new Firefoxdriver () to resolve, as follows:

1  PackageHelloWorld;2 Importorg.openqa.selenium.*;3 Importorg.openqa.selenium.By.ById;4 ImportOrg.openqa.selenium.firefox.FirefoxDriver;5 6  Public classJavatest {7 8      Public Static voidMain (string[] args) {9         //TODO auto-generated Method StubTen          One Webdriver driver; A String BaseURL; -         system.setproperty ("Webdriver.gecko.driver", "f:\\webdriver\\ download \\geckodriver-v0.11.1-win64\\geckodriver.exe ");
-Driver=Newfirefoxdriver (); theBaseurl= "http://www.sogou.com/"; - //Open Sogou Homepage -Driver.get (baseurl+ "/"); - //Enter XX in the search box +Driver.findelement (by.id ("Query")). SendKeys ("XX")); - //Click the Search button +Driver.findelement (By.id ("STB") . Click (); A at - } - -}

However, there was an error after running:

1495555671697 geckodriver INFO Listening on 127.0.0.1:30859May24, 2017 12:07:52Morning Org.openqa.selenium.remote.ProtocolHandshake createsession info: Attempting bi-dialect session, assuming Postel ' s law holds true on the remote end1495555672392mozprofile::p rofile INFO Using profile Path c:\users\admn\appdata\local\temp\rust_mozprofile.62d2gzzyduhh1495555672416Geckodriver::marionette INFO starting browser C:\Program Files (x86) \mozilla Firefox\firefox.exe1495555672563 Geckodriver::marionette INFO connecting to marionette on localhost:180281495555677486 marionette INFO Listening on Port 18028May24, 2017 12:07:57Morning Org.openqa.selenium.remote.ProtocolHandshake createsession Info: Detected dialect:w3cexception in thread"Main"org.openqa.selenium.InvalidArgumentException:Expected [Object Undefined] Undefined to be a stringbuild Info:versio N:' Unknown ', Revision: ' 1969d75 ', Time: ' 2016-10-18 09:43:45-0700 'System info:host:' Admin ', IP: ' 192.168.1.102 ', Os.name: ' Windows 8.1 ', Os.arch: ' AMD64 ', os.version: ' 6.3 ', java.version: ' 1.8.0_31 'Driver info:org.openqa.selenium.firefox.FirefoxDriverCapabilities [{moz:profile=c:\users\admn\appdata\local\temp\rust_mozprofile.62d2gzzyduhh, rotatable=false, Timeouts={implicit=0, pageload=300000, script=30000}, Pageloadstrategy=normal, Platform=any, SpecificationLevel=0, moz:accessibilitychecks=false, acceptinsecurecerts=false, browserversion=53.0.2, platformversion=10.0, moz:processid=14196, Browsername=firefox, platformName=Windows_NT}] Session id:7a0a1695-fe51-4d87-a720-2f7c1baa7038 at Sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method) at sun.reflect.NativeCons Tructoraccessorimpl.newinstance (Unknown Source) at Sun.reflect.DelegatingConstructorAccessorImpl.newInstance ( Unknown source) at Java.lang.reflect.Constructor.newInstance (Unknown source) at Org.openqa.selenium.remote.http.W3CH Ttpresponsecodec.createexception (W3chttpresponsecodec.java:127) at Org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode (W3chttpresponsecodec.java:93) at Org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode (W3chttpresponsecodec.java:42) at Org.openqa.selenium.remote.HttpCommandExecutor.execute (Httpcommandexecutor.java:163) at Org.openqa.selenium.remote.service.DriverCommandExecutor.execute (Drivercommandexecutor.java:82) at Org.openqa.selenium.remote.RemoteWebDriver.execute (Remotewebdriver.java:30T) at Org.openqa.selenium.remote.RemoteWebElement.execute (Remotewebelement.java:274) at Org.openqa.selenium.remote.RemoteWebElement.sendKeys (Remotewebelement.java:98) at HelloWorld. Javatest.main (Javatest.java:19)
View Code

The path to the driver executable must is set by the Webdriver.gecko.driver system property;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.