gpt4 book ai didi

java - 屏幕上显示错误消息 : The driver executable does not exist:/Project/Driver/chromedriver

转载 作者:行者123 更新时间:2023-12-01 19:33:10 27 4
gpt4 key购买 nike

我收到此错误并且无法找到此问题的解决方案,我正在使用 MAC,并且在 Windows 中也能正常工作。

当我调用浏览器时,屏幕上会显示错误消息。这是我的代码。

package Testmavenproject.Project;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class Testing {

public static void main(String[] args)
{
System.setProperty("webdriver.chrome.driver","/Project/Driver/chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://www.qr-code-generator.com/");

}

}

出现错误:

Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: /Project/Driver/chromedriver at com.google.common.base.Preconditions.checkState(Preconditions.java:585) at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:137) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:132) at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:35) at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:156) at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:346) at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:91) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:123) at Testmavenproject.Project.Testing.main(Testing.java:11)

最佳答案

如果您使用的是 Mac,则“.exe”不起作用。确保您有 mac 版 chromedriver。它应该是没有 .exe 的“chromedriver”

关于java - 屏幕上显示错误消息 : The driver executable does not exist:/Project/Driver/chromedriver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59243762/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com