更新:这不是重复的qns,因为Selenium: WebDriverException:Chrome failed to start: crashed as google-chrome is no longer running so ChromeDriver is assuming that Chrome has crashed上的解决方案都不适合我
我将Java应用程序打包为可运行的JAR,用于运行Selenium测试。
以前,启动应用程序时出现错误,“ 无法创建Chrome进程”,但是按照解决方案进行操作后,我“解决了”(或者我相信...)在此thread
中但是,我现在面临另一个错误
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
希望很快能收到你们的来信。谢谢!