簡體   English   中英

似乎無法讓 Eclipse IDE 在我的 Mac 上找到 geckodriver

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

返回的錯誤是:“線程“main”中的異常java.lang.IllegalStateException:驅動程序可執行文件不存在:/usr/local/bin/geckodriver”

如您所見,驅動程序在那里: ➜ bin pwd /usr/local/bin ➜ bin ls geck* geckodriver

我在論壇上搜索了同一問題的許多其他答案,但我嘗試過的任何內容都沒有產生任何影響。 我最初手動安裝了 geckodriver,但是當我無法讓它工作時,我刪除了該文件並通過 brew install 安裝它,但它沒有任何區別。

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");

適用於 Java 開發人員的 Eclipse IDE 版本:2018-12 (4.10.0) 構建 ID:20181214-0600 操作系統:Mac OS X,v.10.14.2,x86_64 / cocoa Java 版本:11.0.1

您需要先使 geckodriver 可執行,然后才能執行腳本。
要使其可執行,您需要轉到其所在的文件夾,在您的情況下是 /usr/local/bin,然后使用 chmod +x 命令使其可執行。
嘗試以下步驟:

cd /usr/local/bin
chmod +x geckodriver

現在您將能夠執行您的腳本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM