Pass Chrome SameSite cookie policies via capabilities

Google has imposed new cookie policies by default for users beginning with Chrome 80, which was released in early 2020.

To learn more about the Google Chrome SameSite cookie policies, see https://docs.adobe.com/content/help/en/target/using/implement-target/before-implement/privacy/google-chrome-samesite-cookie-policies.html.

The code below shows how to enable the experimental option "SameSite by default cookies" in a remote cradle:

Copy
ChromeOptions myChromeOptions = 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);

myChromeOptions.setExperimentalOption("localState", chromeLocalStatePrefs);

capabilities.setCapability(ChromeOptions.CAPABILITY, myChromeOptions);

See also the Perfecto Knowledgebase.