[英]Getting diff. error for chrome driver on azure hosted agent
Error : 错误:
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]
I tried to run my selenium test on Azure hosted agent with diff. 我尝试使用diff在Azure托管代理上运行硒测试。 agents ie Win1803
, win2019
, ubunt-16.04
etc. 代理, win2019
Win1803
, win2019
, ubunt-16.04
等。
I updated chromedriver
and chromedriver.exe
in code based on Os I select in the above agent. 我根据在上述代理中选择的chromedriver.exe
以代码更新了chromedriver
和chromedriver.exe
。
For ubuntu, I am getting an error like: driver is not executable. 对于ubuntu,我收到如下错误:驱动程序不可执行。
I have created the maven project and using Selenium and Java with it. 我已经创建了maven项目,并使用了Selenium和Java。 It runs fine in my local but on Azure pipeline with a hosted agent. 它在本地运行良好,但在具有托管代理的Azure管道上运行良好。
Code I am using : 我正在使用的代码:
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);
Here is a similar case with the same error ,maybe you can find a solution from it, please refer to it for more details. 这是一个类似的情况 ,但有相同的错误,也许您可以从中找到解决方法,请参考它以获取更多详细信息。
An accepted workaround is : 可接受的解决方法是:
1.Try to download HERE and use this latest chrome driver version. 1.尝试下载此处并使用此最新版chrome驱动程序。 https://sites.google.com/a/chromium.org/chromedriver/downloads https://sites.google.com/a/chromium.org/chromedriver/downloads
2.If you have already downloaded the latest chromedriver, try adding the 3 arguments: 2.如果您已经下载了最新的chromedriver,请尝试添加3个参数:
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
d = webdriver.Chrome('/home/PycharmProjects/chromedriver',chrome_options=chrome_options)
d.get('https://www.google.nl/')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.