I try to launch chrome using selenium on AWS windows 2019:
private final String chromeDriverPath = "src{0}main{0}resources{0}chromedriver{0}chromedriver.exe".replace("{0}", File.separator);
private final String chromePath = "C:{0}Program Files{0}Google{0}Chrome{0}Application".replace("{0}", File.separator);
@Test
public void testSelenium() {
System.setProperty("webdriver.chrome.driver", this.chromeDriverPath);
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setBinary(this.chromePath);
chromeOptions.addArguments("--headless");
WebDriver driver = new ChromeDriver(chromeOptions);
driver.close();
}
And I get this error:
Starting ChromeDriver 87.0.4280.88 (89e2380a3e36c3464b5dd1302349b1382549290d-refs/branch-heads/4280@{#1761}) on port 63701
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 3.41 s <<< FAILURE! - in TestSuite
org.openqa.selenium.WebDriverException:
unknown error: Chrome failed to start: crashed.
(chrome not reachable)
(The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: '', ip: '', os.name: 'Windows Server 2019', os.arch: 'amd64', os.version: '10.0', java.version: '14.0.2'
Driver info: driver.version: ChromeDriver
remote stacktrace: Backtrace:
Ordinal0 [0x0113C0C3+3326147]
Ordinal0 [0x01020851+2164817]
Ordinal0 [0x00EA7298+619160]
Ordinal0 [0x00E1E4CB+58571]
Ordinal0 [0x00E1C38A+50058]
Ordinal0 [0x00E45F3E+220990]
Ordinal0 [0x00E45CAC+220332]
Ordinal0 [0x00E4189B+202907]
Ordinal0 [0x00E23DF4+81396]
Ordinal0 [0x00E24DEE+85486]
Ordinal0 [0x00E24D79+85369]
Ordinal0 [0x010385DC+2262492]
GetHandleVerifier [0x012C2874+1487204]
GetHandleVerifier [0x012C23CD+1486013]
GetHandleVerifier [0x012CA368+1518680]
GetHandleVerifier [0x012C2F4E+1488958]
Ordinal0 [0x0102ED0D+2223373]
Ordinal0 [0x0103A12B+2269483]
Ordinal0 [0x0103A26F+2269807]
Ordinal0 [0x0104ECB8+2354360]
BaseThreadInitThunk [0x733A0419+25]
RtlGetAppContainerNamedObjectPath [0x77B766ED+237]
RtlGetAppContainerNamedObjectPath [0x77B766BD+189]
chromedriver version: 87.0.4280.88 chrome version: 87.0.4280.88 selenium version: 3.141.59
I verified chrome version:
Running command PowerShell -Command "(Get-Item (Get-ItemProperty
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe').'(Default)').VersionInfo"
ProductVersion FileVersion FileName
-------------- ----------- --------
87.0.4280.88 87.0.4280.88 C:\Program Files\Google\Chrome\Application...
I also tried adding the following arguments but nothing solved it:
chromeOptions.addArguments("--disable-dev-shm-usage");
chromeOptions.addArguments("--remote-debugging-port=9222");
chromeOptions.addArguments("--no-sandbox");
Edit: In chromedriver log I see this error:
[1608729679.424][DEBUG]: DevTools HTTP Request: http://localhost:49214/json/version
[1608729681.457][DEBUG]: DevTools HTTP Request failed
[1608729681.460][INFO]: [4e889dd42b249ac78f0ab49aab5abb6b] RESPONSE InitSession ERROR unknown error: Chrome failed to start: crashed.
Any ideas?