我已将驱动程序路径添加到系统属性中
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
我该如何解决这个问题?
尝试检查我的路径是否错误,但事实并非如此。
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);