gpt4 book ai didi

java - Chrome 驱动程序 : Custom Chrome Executable Path

转载 作者:塔克拉玛干 更新时间:2023-11-01 22:46:13 25 4
gpt4 key购买 nike

我使用的是 Google Chrome 的便携版。

由于 WebDriver 需要默认安​​装路径,所以它没有找到明显位于其他位置的可移植安装路径:

Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 11.13 seconds
Build info: version: '2.35.0', revision: '8df0c6b', time: '2013-08-12 15:43:19'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_05'
Driver info: org.openqa.selenium.chrome.ChromeDriver

如何设置 chrome.exe 文件的自定义路径?

最佳答案

没关系,我自己找到了答案:

ChromeOptions options = new ChromeOptions();
options.setBinary("/path/to/chrome/binary");

ChromeDriver driver = new ChromeDriver(options);

Chromedriver docs

关于java - Chrome 驱动程序 : Custom Chrome Executable Path,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23978464/

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