0

更新:这不是重复的 qns,因为 Selenium 没有解决方案:WebDriverException:Chrome 无法启动:由于 google-chrome 不再运行而崩溃,因此 ChromeDriver 假设 Chrome 已崩溃 对我有用

我将我的 Java 应用程序打包为一个可运行的 JAR 来运行 Selenium 测试。

以前,我在启动应用程序时遇到错误,“无法创建 Chrome 进程”,但是在遵循此线程中的解决方案后,我将其“解决”(或者我相信......)

但是,我现在面临另一个错误,

Chrome failed to start: Crashed 
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location ..... is no longer running, so ChromeDriver is assuming that Chrome has crashed)

这是我使用的代码和选项的片段。

System.setProperty("webdriver.chrome.driver", "C:\\.......\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("useAutomationExtension", false);
options.setBinary("C:\\.......\\chrome.exe");
options.addArguments("--disable-dev-shm-usage"); 
options.addArguments("start-maximized"); 
options.addArguments("disable-infobars"); 
options.addArguments("--disable-extensions"); 
options.addArguments("--disable-gpu"); 
options.addArguments("--no-sandbox"); 
browser = new ChromeDriver(options);

我还能错过什么?

更多细节

- Using combination of chromedriver.exe (76.0.3809.126) and chrome.exe (76.0.3809.132) 
- Selenium 3.141.59
Works when running from eclipse on development pc

希望很快能收到你们的来信。谢谢!

4

0 回答 0