Jenkins执行selenium自动化时,出现如下错误,一定要确保浏览器是隐藏模式启动。
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
(unknown error: DevToolsActivePort file doesn't exist)
ChromeOptions chromeOptions = new ChromeOptions();
// 禁用沙箱
chromeOptions.addArguments("--no-sandbox");
chromeOptions.addArguments("--disable-dev-shm-usage");
chromeOptions.addArguments("--headless");
原文链接:https://blog.csdn.net/shadow_kong/article/details/106100890