Selenium Webdriver: Delete Cookies On All Domains

2020-07-03 06:28发布

In selenium you can only delete cookies on the current domain, but would it be possible to navigate to the file where Firefox is storing the cookies and either delete the file or overwrite it? I've been looking around, but can't find where selenium stores the cookies.

2条回答
等我变得足够好
2楼-- · 2020-07-03 06:43

Selenium doesn't store the cookies, the browser does. So the answer to "where [the browser] stores the cookies" will be different for each browser. But since Selenium always starts the browser with a clean profile, you shouldn't have to do this - there are no cookies when the browser starts.

查看更多
家丑人穷心不美
3楼-- · 2020-07-03 06:53

You can specify a user directory and then manipulate <userdir>/Default/Cookies. This question is similar: Getting or Manipulating all cookies in Selenium Webdriver

查看更多
登录 后发表回答