Selenium2:删除所有 cookie,甚至是与当前域无关的 cookie [英] Selenium2: Deleting ALL cookies, even ones not related to the current domain

查看:31
本文介绍了Selenium2:删除所有 cookie,甚至是与当前域无关的 cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个测试,它需要在启动时从多个域中删除 cookie.driver.manage().deleteAllCookies() 似乎只删除由您当前所在的域设置的 cookie.

I am writing a test which needs to delete cookies from a number of domains when it starts up. driver.manage().deleteAllCookies() seems to only delete cookies set by the domain you're currently on.

有没有办法强制浏览器清除所有 cookie?

Is there a way to force the browser to clear all cookies?

推荐答案

如果您想删除所有 cookie,您应该使用一个配置文件.如果每次 selenium 都在创建新的匿名配置文件,则无法删除这些 cookie.

You should use one profile if you want to delete all cookies. If every time selenium is creating new anonymous profile it is not possible to delete those cookies.

这篇关于Selenium2:删除所有 cookie,甚至是与当前域无关的 cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆