我已正确添加 chromedriver 二进制文件的路径,但它显示未找到二进制文件,我该如何修复此问题?

问题描述 投票:0回答:1

我已将驱动程序路径添加到系统属性中

        System.setProperty("webdriver.chrome.driver","/home/k0r0/CFT/chromedriver-linux64/chromedriver");

出现此错误

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: cannot find Chrome binary 

我该如何解决这个问题?

尝试检查我的路径是否错误,但事实并非如此。

selenium-webdriver ui-automation
1个回答
0
投票
you have to add the extension at end of the line 

System.setProperty("webdriver.chrome.driver","/home/k0r0/CFT/chromedriver-linux64/chromedriver.exe");

**or** 

If the first mechanism did not work then follow the below code, before that you have to upgrade your selenium version to 4+.

ChromeOptions options = new ChromeOptions();
options.addArguments("--remote-allow-origins=*");
WebDriver driver = new ChromeDriver(options);
© www.soinside.com 2019 - 2024. All rights reserved.