Friday, March 14, 2025

automated testing – unknown error: can not create temp dir for unpacking extensions when making an attempt to begin Chrome from a LOCAL_SYSTEM service


We are attempting to get our automated webtests working independently of what model of Chrome we’re utilizing. These automated exams work as follows:

  1. We have now a Karaf container agent operating as a service;
  2. Karaf begins an ant script, which in flip begins one other ant script. The primary ant script is a part of the automation instrument we use (our personal product) and the second ant script is the precise script that begins our testng webtests;
  3. TestNg, throughout the startup, begins the ChromeDriver within the following means utilizing the bonigarcia Webdrivermanager library:

        WebDriverManager.chromedriver().setup();
        // webDriver = new ChromeDriver();
        ChromeOptions choices = new ChromeOptions();
    
        // ChromeDriver is simply AWFUL as a result of each model or two it breaks until you cross cryptic arguments
        //AGRESSIVE: choices.setPageLoadStrategy(PageLoadStrategy.NONE); // https://www.skptricks.com/2018/08/timed-out-receiving-message-from-renderer-selenium.html
        choices.addArguments("--enable-automation"); // https://stackoverflow.com/a/43840128/1689770
        choices.addArguments("--headless"); // solely in case you are ACTUALLY operating headless
        choices.addArguments("--no-sandbox"); //https://stackoverflow.com/a/50725918/1689770
        choices.addArguments("--disable-infobars"); //https://stackoverflow.com/a/43840128/1689770
        choices.addArguments("--disable-dev-shm-usage"); //https://stackoverflow.com/a/50725918/1689770
        choices.addArguments("--disable-gpu"); //https://stackoverflow.com/questions/51959986/how-to-solve-selenium-chromedriver-timed-out-receiving-message-from-renderer-exc
        choices.addArguments("--window-size=1920,1080");
        choices.addArguments("--start-maximized");
        choices.addArguments("--disable-extensions");
        choices.setExperimentalOption("useAutomationExtension", false);
        choices.addArguments("--bwsi");
        choices.addArguments("--user-data-dir="+ System.getProperty("check.net.chrome.information.dir") +"/user-data-dir");
        choices.addArguments("--disk-cache-dir="+ System.getProperty("check.net.chrome.information.dir") +"/disk-cache-dir");
        attempt {
            File logFile = new File(System.getProperty("check.net.chrome.information.dir").substitute("https://sqa.stackexchange.com/", "") + "logschromedriver.log");
            logFile.getParentFile().mkdirs();
            logFile.createNewFile();
            boolean verbose = System.getProperty("check.net.webdriver.verbose").equals("true");
            ChromeDriverService driverService = new Builder().withVerbose(verbose).withLogFile(logFile).construct();
    
    
            webDriver = new ChromeDriver(driverService, choices);
        } catch (IOException e) {
            LOGGER.error(e);
            webDriver = new ChromeDriver(choices);
        }
    

The issue we have now is that if the Karaf agent is operating because the LOCAL_SYSTEM account (which is the default person when creating a brand new service), the Chromedriver cannot begin Chrome with the error:

unknown error: can not create temp dir for unpacking extensions

After some googling and testing, I’ve discovered it is because when beginning the ChromeDriver, it tries to create a short lived folder for unpacking extensions within the person temp listing, which fails as a result of the LOCAL_SYSTEM account would not have a person listing.

I can work across the problem by making the service run as a LOCAL_SERVICE account, which does have a person listing, however we have discovered that another scripts that run on this Karaf agent give issues when operating as LOCAL_SERVICE (primarily older software program integrations that we will not simply improve), so ideally I am hoping for an answer that makes LOCAL_SYSTEM work.

Is there a technique to repair the temp dir downside that the Chromedriver has when trying to begin Chrome from a LOCAL_SYSTEM service?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles

PHP Code Snippets Powered By : XYZScripts.com