【发布时间】:2020-01-17 12:52:55
【问题描述】:
我想这应该可行:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_experimental_option('same-site-by-default-cookies', 'true')
driver = webdriver.Chrome(chrome_options=options)
启用为未来的 chrome 版本安排的相同站点 cookie 限制。不是,有错误:
selenium.common.exceptions.InvalidArgumentException:
Message: invalid argument: cannot parse capability: goog:chromeOptions
from invalid argument: unrecognized chrome option: same-site-by-default-cookies
我可以使用 chrome://flags 手动更改选项并查看它是否有效。但是我想自动化它并运行测试脚本来查看它。
这里有java代码:https://groups.google.com/forum/#!topic/chromedriver-users/cI8hj7eihRo 可以做到,但是我不确定如何将其传输到 python。
是否有任何参考资料可以帮助我设置此选项或其他选项?
【问题讨论】:
标签: python-3.x selenium google-chrome selenium-chromedriver samesite