如何使用 selenium 删除 google chrome cookie?

Jay*_*sby 4 cookies selenium google-chrome

我正在尝试删除所有 google chrome cookie。我正在使用在 selenium 网站上找到的这段代码:

var driver = new ChromeDriver();
driver.Manage().Cookies.DeleteAllCookies();
Run Code Online (Sandbox Code Playgroud)

但是当我执行它时,会出现一个带有此文本的 dos 页面

Starting ChromeDriver 2.13.307647 (5a7d0541ebc58e69994a6fb2ed930f45261f3c29) on
port 25398
Only local connections are allowed.
Run Code Online (Sandbox Code Playgroud)

谷歌浏览器启动。我错过了什么?如何删除存储的 cookie?

kma*_*zek 5

该方法DeleteAllCookies();将删除当前域的所有 cookie [Handling Cookies in Webdriver]

如果您想删除所有域的所有 cookie,您应该使用 Chrome 设置“清除浏览数据”中的解决方案。

这里有使用示例。