我对最后一个 chromedriver 有疑问。每次都失败并出现以下错误:
Starting ChromeDriver 2.45.615279 (12b89733300bd268cff3b78fc76cb8f3a7cc44e5) on port 2393 Only local connections are allowed. org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
浏览器版本为
Version 71.0.3578.98 (Official Build) (64-bit)
当我从 eclipse 运行时,一切正常,不会失败。仅当我从 Jenkins 或 Linux 控制台运行时失败。 chromedriver 进程在 Linux 上仍然挂起。有解决办法吗?
最佳答案
尝试添加 --no-sandbox
标志:
ChromeOptions ChromeOptions = new ChromeOptions();
ChromeOptions.addArguments("--headless", "window-size=1024,768", "--no-sandbox");
driver = new ChromeDriver(ChromeOptions);
或者,根据建议,--single-process
选项帮助了一些人 here .
关于linux - 从 Jenkins 或 Linux 控制台运行时 Chromedriver 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54230260/