Software Quality Assurance & Testing Asked on December 10, 2021
We are trying to get our automated webtests working independently of what version of Chrome we’re using. These automated tests work as follows:
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?
Try to update vcqruntime 140 dll. I did that, and it works fine now.
Answered by user43773 on December 10, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP