Jas*_*Law 0 java selenium selenium-chromedriver
我想禁用 Chrome 实验选项same-site-by-default-cookies和cookies-without-same-site-must-be-secure.
从How to set Chrome Experimental option same-site-by-default-cookie in python selenium - Stack Overflow,我知道如何启用,但如果我想禁用该怎么办?
您可以使用same-site-by-default-cookies@2&禁用cookies-without-same-site-must-be-secure@2。在版本 80.0.3987.122(官方版本)(64 位)上测试
ChromeOptions options = new ChromeOptions();
Map<String, Object> chromeLocalStatePrefs = new HashMap<>();
List<String> experimentalFlags = new ArrayList<>();
experimentalFlags.add("same-site-by-default-cookies@2");
experimentalFlags.add("cookies-without-same-site-must-be-secure@2");
chromeLocalStatePrefs.put("browser.enabled_labs_experiments", experimentalFlags);
options.setExperimentalOption("localState", chromeLocalStatePrefs);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2982 次 |
| 最近记录: |