gpt4 book ai didi

java - 无法启动Chrome驱动程序-macOS- Selenium Java-测试

转载 作者:行者123 更新时间:2023-12-03 12:22:48 26 4
gpt4 key购买 nike

当我尝试执行maven安装时,此错误使进程停止
任何帮助都将如此巨大。自2天以来一直停滞不前。

失败的Java代码

ChromeOptions opt = new ChromeOptions();
opt.setBinary(System.getProperty("binary_path"));
ChromeDriverService service = new ChromeDriverService.Builder().build();
driver = new ChromeDriver(service, opt); <-- at this line.

控制台错误
[INFO] Running TestSuite
[TestNGContentHandler] [WARN] It is strongly recommended to add "<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >" at the top of your file, otherwise TestNG may fail or not work as expected.
Starting ChromeDriver 80.0.3987.16 (320f6526c1632ad4f205ebce69b99a062ed78647-refs/branch-heads/3987@{#185}) on port 28707
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1585902743.548][WARNING]: FromSockAddr failed on netmask
[ERROR] Tests run: 11, Failures: 1, Errors: 0, Skipped: 10, Time elapsed: 1.386 s <<< FAILURE! - in TestSuite
[ERROR] setUpScript(com.***.TestBase) Time elapsed: 1.149 s <<< FAILURE!
org.openqa.selenium.WebDriverException:
unknown error: DevToolsActivePort file doesn't exist
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'

PS:它是一种 Electron 应用程序,可在macOS中运行

最佳答案

您需要添加以下参数:

opt.addArguments("--disable-dev-shm-usage")

这是因为此消息 DevToolsActivePort文件不存在

关于java - 无法启动Chrome驱动程序-macOS- Selenium Java-测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61007935/

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