错误 :
org.openqa.selenium.WebDriverException:
unknown error: Chrome failed to start: was killed
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location D:/a/1/s/src/test/resources/drivers/chromedriver.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'fv-az45', ip: '10.1.0.4', os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_222'
Driver info: driver.version: ChromeDriver
remote stacktrace: Backtrace:
Ordinal0 [0x013D7C53+1473619]
Ordinal0 [0x0135AD71+961905]
Ordinal0 [0x012E42B3+475827]
Ordinal0 [0x0127C2AB+49835]
Ordinal0 [0x01299149+168265]
Ordinal0 [0x01298D1D+167197]
Ordinal0 [0x0129742B+160811]
Ordinal0 [0x01280AE6+68326]
Ordinal0 [0x01281BF0+72688]
Ordinal0 [0x01281B89+72585]
Ordinal0 [0x01374B37+1067831]
GetHandleVerifier [0x01476845+506677]
GetHandleVerifier [0x014765E0+506064]
GetHandleVerifier [0x0147D188+533624]
GetHandleVerifier [0x0147701A+508682]
Ordinal0 [0x0136C226+1032742]
Ordinal0 [0x0136C09F+1032351]
Ordinal0 [0x01376A4B+1075787]
Ordinal0 [0x01376BB3+1076147]
Ordinal0 [0x01375B65+1071973]
BaseThreadInitThunk [0x773562C4+36]
RtlSubscribeWnfStateChangeNotification [0x775F1F69+1081]
RtlSubscribeWnfStateChangeNotification [0x775F1F34+1028]
我尝试在带有差异的 Azure 托管代理上运行我的 selenium 测试。代理即Win1803
,win2019
等ubunt-16.04
我根据我在上述代理中选择的操作系统更新chromedriver
并使用代码。chromedriver.exe
对于 ubuntu,我收到如下错误:驱动程序不可执行。
我创建了 maven 项目并使用 Selenium 和 Java。它在我的本地运行良好,但在带有托管代理的 Azure 管道上运行。
我正在使用的代码:
HashMap<String, Object> chromePrefs = new HashMap<String, Object>();
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", chromePrefs);
DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setJavascriptEnabled(true);
cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
cap.setCapability(ChromeOptions.CAPABILITY, options);
System.setProperty("webdriver.chrome.driver", Constants.AppPath.CHROME_PATH);
chromePrefs.put("profile.default_content_settings.popups", 0);
chromePrefs.put("download.default_directory", downloadFilepath);
// options.addArguments("--headless");
//options.addArguments("--window-size=1366,768");
options.setBinary(Constants.AppPath.CHROME_PATH);
options.addArguments("--no-sandbox");
options.addArguments("--disable-popup-blocking");
options.addArguments("--disable-dev-shm-usage");
options.addArguments("--disable-gpu");
options.addArguments("--dns-prefetch-disable");
options.addArguments("--always-authorize-plugins");
options.addArguments("enable-automation");
options.addArguments("--disable-browser-side-navigation");
options.addArguments("--ignore-certificate-errors");
options.addArguments("--disable-extensions");
options.setPageLoadStrategy(PageLoadStrategy.NORMAL);
driver = new ChromeDriver(options);