My selenium setup is:
WebDriverManager.chromedriver().setup();
ChromeOptions ops = new ChromeOptions();
ops.addArguments("--remote-allow-origins=*");
ops.addArguments("--disable-popup-blocking");
ops.addArguments("--disable-notifications");
ops.addArguments("--disable-infobars");
ops.addArguments("--disable-extensions");
ops.addArguments("--start-maximized");
ops.addArguments("--guest");
ops.addArguments("--no-first-run");
ops.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true);
ops.setExperimentalOption("excludeSwitches", new String[]{"enable-automation"});
baseDriver = new ChromeDriver(ops);
With this, I see error while launching test:
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
I also tried to add unique value for 'use-data-dir' as suggested in errormessage:
Path tempProfileDir = Files.createTempDirectory("selenium-profile");
ops.addArguments("--user-data-dir=" + tempProfileDir.toAbsolutePath())
But this too has same issue.
What am I missing?
Edit:
I see that chrome settings show version as '138.0.7204.97', while when selenium test runs, it downloads '138.0.7204.92' at '....cache\selenium\chromedriver\win64'. Can this mismatch be the issue? And can I force it to use correct version?
Another Edit:
I forced it to use 138.0.7204.97,and now downloaded version is same too. But I still see same error.