Selenium using Java - The path to the driver executable must be set by the webdriver.gecko.driver system property

前端 未结 6 1128
清酒与你
清酒与你 2020-11-22 05:01

I am trying to launch Mozilla but still I am getting this error:

Exception in thread \"main\" java.lang.IllegalStateException: The path to the driver

6条回答
  •  感动是毒
    2020-11-22 05:19

    1. Download gecko driver from the seleniumhq website (Now it is on GitHub and you can download it from Here) .
      1. You will have a zip (or tar.gz) so extract it.
      2. After extraction you will have geckodriver.exe file (appropriate executable in linux).
      3. Create Folder in C: named SeleniumGecko (Or appropriate)
      4. Copy and Paste geckodriver.exe to SeleniumGecko
      5. Set the path for gecko driver as below

    .

    System.setProperty("webdriver.gecko.driver","C:\\geckodriver-v0.10.0-win64\\geckodriver.exe");
    WebDriver driver = new FirefoxDriver();
    

提交回复
热议问题