gpt4 book ai didi

java - Selenium Webdriver 在 Internet Explorer 中获取完整域的 cookie

转载 作者:搜寻专家 更新时间:2023-11-01 03:04:49 25 4
gpt4 key购买 nike

我试图从网站的整个域中获取 Cookie,但我似乎无法获取它。这是我的代码:

Set<Cookie> cookies = driver.manage().getCookies();

for (Cookie cookie : cookies) {
System.out.println(cookie);
}

这就是我想要的,但是,我有一个具有另一个路径值的 cookie,而这个片段没有返回正确的 cookie,有什么想法吗?

注意:这在 Chrome 和 Firefox 上完美运行,有问题的浏览器是 IE。

最佳答案

据我所知,Internet Explorer 在使用 selenium 打开时会维护早期 Activity 中的 cookie 和缓存。在启动时,您可以清理实例。

capabilities = DesiredCapabilities.InternetExplorer();
capabilities.SetCapability("ie.ensureCleanSession", true);

ie.ensureCleanSession

When set to true, this capability clears the cache, cookies, history, and saved form data. When using this capability, be aware that this clears the cache for all running instances of Internet Explorer, including those started manually.

请告诉我这些信息是否有帮助

谢谢

关于java - Selenium Webdriver 在 Internet Explorer 中获取完整域的 cookie,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26341338/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com