ChromeWebDriver - unknown error: Chrome failed to start: crashed
DesiredCapabilities capability = DesiredCapabilities.chrome();
System.setProperty("webdriver.chrome.driver", "path to chromedriver.exe");
capability.setBrowserName("chrome");
capability.setPlatform(PlatformAndEnvironmentSetUp.platformSetUp);
driver = new RemoteWebDriver(new URL("http://" + PlatformAndEnvironmentSetUp.hubIP + ":" + PlatformAndEnvironmentSetUp.hubPort + "/wd/hub"), capability);
this.driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
this.driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
this.driver.manage().window().setSize(new Dimension(1920, 1080));
//page instances init()
loginPage = PageFactory.initElements(this.driver, LoginPage.class);
homePage = PageFactory.initElements(this.driver, AdminHomePage.class);
This sample code works OK for me. Just a little note: "chromedriver.exe" I'm placing in the same project folder. That makes the question of path to chromdriver executable easier.
So this line of code looks in this way:
System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
Resource to download chromedriver.exe
Hope this helps you.
Eventually I found out that WebDriver was trying to run Chrome from C:\Users\______\AppData\Local\Google\Chrome\Application\chrome.exe
, which was not working even when trying it manually. It was very strange because when I launch Chrome I use one installed in Program Files
directory and it works without problems.
So I had uninstalled Chrome, deleted everything from c:\Users______\AppData\Local\Google\Chrome\
and installed Chrome again. After that it started working.
Uninstall, delete chrome profile from c:\Users______L\AppData\Local\Google\Chrome\ and reinstall chrome will fix the problem, it worked for me
I had the same problem as above. and I solved it. I run selenium with chromium in alpine. My environment:
- Alpine (Linux 3.13.0-24-generic x86_64)
- Chromium 53.0.2785.92
- chromedriver=2.22
- selenium (3.0.1)
and I met the error information is:
File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed
(Driver info: chromedriver=2.22 (5e2d5494d735a71aa5c2e7ef9bf5ce96945e92e9),platform=Linux 3.13.0-24-generic x86_64)
My solution is run:
apk add libexif udev
and Then it works.
I refer to here : https://hub.docker.com/r/rodrigomiguele/chromium/~/dockerfile/