Map<String, Object> chromePrefs = new HashMap<>();
chromePrefs.put("same-site-by-default-cookies", true);
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setExperimentalOption("prefs", chromePrefs);
return new ChromeDriver(chromeOptions);
driver.get("chrome://flags/");
WebElement sameSiteSelect = driver.findElementByCssSelector("select[aria-labelledby=same-site-by-default-cookies_name]");
Select sameSite = new Select(sameSiteSelect);
sameSite.selectByVisibleText("Enabled");
driver.findElementById("experiment-restart-button").click();
org.openqa.selenium.WebDriverException: chrome not reachable
ChromeOptions chromeOptions = new ChromeOptions();
HashMap<String, Object> chromeLocalStatePrefs = new HashMap<String, Object>();
List<String> experimentalFlags = new ArrayList<String>();
experimentalFlags.add("same-site-by-default-cookies@1");
chromeLocalStatePrefs.put("browser.enabled_labs_experiments",experimentalFlags);
chromeOptions.setExperimentalOption("localState", chromeLocalStatePrefs);