1

We are trying to get our automated webtests working independently of what version of Chrome we're using. These automated tests work as follows:

  1. We have a Karaf container agent running as a service;
  2. Karaf starts an ant script, which in turn starts another ant script. The first ant script is part of the automation tool we use (our own product) and the second ant script is the actual script that starts our testng webtests;
  3. TestNg, during the startup, starts the ChromeDriver in the following way using the bonigarcia Webdrivermanager library:

        WebDriverManager.chromedriver().setup();
        // webDriver = new ChromeDriver();
        ChromeOptions options = new ChromeOptions();
    
        // ChromeDriver is just AWFUL because every version or two it breaks unless you pass cryptic arguments
        //AGRESSIVE: options.setPageLoadStrategy(PageLoadStrategy.NONE); // https://www.skptricks.com/2018/08/timed-out-receiving-message-from-renderer-selenium.html
        options.addArguments("--enable-automation"); // https://stackoverflow.com/a/43840128/1689770
        options.addArguments("--headless"); // only if you are ACTUALLY running headless
        options.addArguments("--no-sandbox"); //https://stackoverflow.com/a/50725918/1689770
        options.addArguments("--disable-infobars"); //https://stackoverflow.com/a/43840128/1689770
        options.addArguments("--disable-dev-shm-usage"); //https://stackoverflow.com/a/50725918/1689770
        options.addArguments("--disable-gpu"); //https://stackoverflow.com/questions/51959986/how-to-solve-selenium-chromedriver-timed-out-receiving-message-from-renderer-exc
        options.addArguments("--window-size=1920,1080");
        options.addArguments("--start-maximized");
        options.addArguments("--disable-extensions");
        options.setExperimentalOption("useAutomationExtension", false);
        options.addArguments("--bwsi");
        options.addArguments("--user-data-dir="+ System.getProperty("test.web.chrome.data.dir") +"/user-data-dir");
        options.addArguments("--disk-cache-dir="+ System.getProperty("test.web.chrome.data.dir") +"/disk-cache-dir");
        try {
            File logFile = new File(System.getProperty("test.web.chrome.data.dir").replace("/", "\\") + "\\logs\\chromedriver.log");
            logFile.getParentFile().mkdirs();
            logFile.createNewFile();
            boolean verbose = System.getProperty("test.web.webdriver.verbose").equals("true");
            ChromeDriverService driverService = new Builder().withVerbose(verbose).withLogFile(logFile).build();
    
    
            webDriver = new ChromeDriver(driverService, options);
        } catch (IOException e) {
            LOGGER.error(e);
            webDriver = new ChromeDriver(options);
        }
    

The problem we have is that if the Karaf agent is running as the LOCAL_SYSTEM account (which is the default user when creating a new service), the Chromedriver can't start Chrome with the error:

unknown error: cannot create temp dir for unpacking extensions

After some googling and testing, I've found this is because when starting the ChromeDriver, it tries to create a temporary folder for unpacking extensions in the user temp directory, which fails because the LOCAL_SYSTEM account doesn't have a user directory.

I can work around the issue by making the service run as a LOCAL_SERVICE account, which does have a user directory, but we've found that some other scripts that run on this Karaf agent give problems when running as LOCAL_SERVICE (mainly older software integrations that we can't easily upgrade), so ideally I'm hoping for a solution that makes LOCAL_SYSTEM work.

Is there a way to fix the temp dir problem that the Chromedriver has when attempting to start Chrome from a LOCAL_SYSTEM service?

2
  • why don't you create a dedicated user for running service and grant all appropriate privileges to that user?
    – Alexey R.
    Commented Feb 12, 2019 at 11:46
  • @AlexeyR. We have considered that, but some of the integrations have licensing restrictions that prevent us from easily doing that.
    – Nzall
    Commented Feb 12, 2019 at 11:50

1 Answer 1

0

Try to update vcqruntime 140 dll. I did that, and it works fine now.

1
  • 3
    Could you give a bit more detail on what vcqruntime 140 dll exactly is and how to update it? a 1 line answer is generally not very liked here.
    – Nzall
    Commented Feb 24, 2020 at 8:02

Your Answer

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

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