简体   繁体   中英

Cannot seem to get Eclipse IDE to find the geckodriver on my Mac

The error being returned is: "Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: /usr/local/bin/geckodriver⁩"

The driver is there as you can see: ➜ bin pwd /usr/local/bin ➜ bin ls geck* geckodriver

I've searched the many other answers to this same question on the forum but nothing I've tried has a made a difference. I initially installed the geckodriver manually, but when I couldn't get it to work I deleted the file and installed it via brew install, but it didn't make a difference.

package automationFramework;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

public class WebTestMainPage {

    public static void main(String[] args) {

        System.setProperty("webdriver.gecko.driver", "/usr/local/bin/geckodriver⁩");
        WebDriver driver = new FirefoxDriver();
        driver.get("http://www.store.demoqa.com");

Eclipse IDE for Java Developers Version: 2018-12 (4.10.0) Build id: 20181214-0600 OS: Mac OS X, v.10.14.2, x86_64 / cocoa Java version: 11.0.1

You need to make the geckodriver executable first and then you would be able to execute the script.
To make it executable you need to go the folder where its located, in your case its /usr/local/bin and then make it executable using chmod +x command.
Try following steps:

cd /usr/local/bin
chmod +x geckodriver

Now you would be able to execute your script.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM