来源:如何在pythonselenium中设置Chrome实验选项same-site-by-default-cookie
设置为 Disabled:
options = ChromeOptions()
experimental_flags = ['same-site-by-default-cookies@2', 'cookies-without-same-site-must-be-secure@2']
chrome_local_state_prefs = {'browser.enabled_labs_experiments': experimental_flags}
options.add_experimental_option('localState', chrome_local_state_prefs)
driver = webdriver.Chrome(options=chrome_options)
设置为 Enabled 的话,把 @2
换成 @1
即可;设置为 Default 的话,把 @2
换成 @0
即可。