0

Any new leads on this issue? I recently switched PC and now facing the same problem so many users faced. It was usually solved with downloading the latest chromedriver.exe or by moving the chrome.exe under the appdata folder structure but now I have done all the basic steps mentioned in various forums and answers but still getting the org.openqa.selenium.WebDriverException: unknown error: Failed to create Chrome process.

Tried --no-sandbox option, tried checking chrome.exe to have the run as admin unchecked. Nothing seems to be working.

My old pc had terrible config of all of the above and never faced an issue (magic). Now I cannot get it to work.

The exception is produced from this line: driver = new ChromeDriver(options);

and the code giving the options to chrome is:

 System.setProperty("webdriver.chrome.driver", 
 System.getProperty("user.dir") + "/src/main/resources/drivers/chromedriver.exe");

 final String regex = "^\\D*\\$$";
 final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
 final Matcher matcher = pattern.matcher(System.getProperty("user.name"));
 boolean isNotHuman = matcher.matches();

 ChromeOptions options = new ChromeOptions();
 if (isNotHuman){
        log.info("Chrome starting headless - isNotHuman: " + isNotHuman + " process run by " +System.getProperty("user.name")) ;
        options.addArguments("--headless");
        options.addArguments("--window-size=1980,1080");
 else {
        log.info("Chrome starting maximized - isNotHuman: " + isNotHuman + " process run by " +System.getProperty("user.name"));
        //options.addArguments("--no-sandbox");
        options.addArguments("--start-maximized");
 }
5
  • Haris, can you share the relevant code that triggers and error and the command to execute it? BTW "Any new leads on this issue?", "the same problem so many users faced"? I didn't get it. Nov 11, 2021 at 13:41
  • Do you have Chrome installed?
    – Mate Mrše
    Nov 11, 2021 at 13:43
  • Yes Chrome is installed (as far as I can see, since I am using it). I have updated the initial description with some code chunks. I tried commenting to an existing question but I am not allowed to comment yet :( and I have seen various questions about this specific, that's why I mentioned "so many users" Nov 11, 2021 at 13:44
  • According to stackoverflow.com/questions/51851142/…, you should set Chrome not to run as Admin.
    – Mate Mrše
    Nov 11, 2021 at 13:47
  • Done that as I mention in my description and no luck :( the chrome.exe file has the run as admin unchecked. Nov 11, 2021 at 13:53

1 Answer 1

1

I saw it in yet another question about this particular problem and I thought "no way this would work", but I tried it anyway. I uninstalled and reinstalled Chrome. Removed the /application folder under the appdata and magically it worked. So, solutions that usually work:

  1. Get latest chromedriver.exe that is compatible with your installed chrome
  2. Verify that chrome is installed in the default location (some times, it helps to move the chrome.exe file under C:\Users<user>\AppData\Local\Google\Chrome\Application)
  3. Verify that chrome.exe does not run as admin (through properties-compatibility)
  4. Reinstall Chrome

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.