Я получаю сообщение об ошибке ниже. Последние два дня пытаются решить проблему.
unknown error: chrome failed to start
(Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),
platform=Windows NT 10.0.17134 x86_64) (WARNING: The server did not provide any
stacktrace information)
Сведения о моем окружении приведены ниже
- Операционная система: Windows 10
- Chrome Driver: 2,40
- Селен: 3.12.0
- Java: 1.8.172
Мой код ниже
System.setProperty("webdriver.chrome.verboseLogging", "true");
// Check Operating System
String osName = System.getProperty("os.name");
// Set OS Related Information
String wChromeDriverPath = "C:\\MyCloud\\external\\chromedriver.exe";
String wChromePath = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe";
String lChromeDriverPath = "/usr/bin/chromedriver";
String lChromePath = "/usr/bin/google-chrome-stable";
// Set Windows as Default
String chromeDriverPath = wChromeDriverPath;
String chromePath = wChromePath;
// Set OS Specific Chrome Driver & Chrome
if(osName.toLowerCase().indexOf("linux") >= 0){
chromeDriverPath = lChromeDriverPath;
chromePath = lChromePath;
}
//Set Chrome Driver
System.setProperty("webdriver.chrome.driver", chromeDriverPath);
webdriver = null
if(osName.toLowerCase().indexOf("linux") >= 0){
ChromeOptions options = new ChromeOptions();
options.setBinary(chromePath);
options.addArguments("--disable-dev-shm-usage");
options.addArguments("--disable-extensions", "--headless", "--disable-gpu", "--no-sandbox");
webdriver = new ChromeDriver(options);
}
else{
//No Chrome Options. Need to See the Chrome Window for testing
webdriver = new ChromeDriver();
}
webdriver.get("about:blank");