【问题标题】:Getting all the cookies set in all iframes using Selenium InternetExplorerDriver使用 Selenium InternetExplorerDriver 获取所有 iframe 中设置的所有 cookie
【发布时间】:2015-10-28 00:58:21
【问题描述】:

这是我的问题:

我使用 Selenium InternetExplorer 驱动程序通过单击按钮打开一个新的浏览器窗口:

WebElement element = driver.findElement(By.id("btnOpen"));
element.sendKeys("\n");

新的浏览器窗口打开,并在该窗口的一个框架中自动提交表单设置了许多 cookie。

首先我将焦点转移到新窗口:

driver.switchTo().window(popupHandle);

然后我将焦点转移到通过自动提交表单设置了新 cookie 的框架

driver.switchTo().frame("fm_MainApp");

现在当我遍历驱动程序中的所有 cookie 时:

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

驱动程序没有显示使用自动提交表单设置的cookie,但我可以清楚地看到cookie已在IE中使用httpAnalyzer设置。

cookies 也是从本地域设置的,而不是第三方。

所以我可以在 IE 中看到 cookie 但驱动程序看不到它们?

【问题讨论】:

    标签: internet-explorer cookies selenium


    【解决方案1】:

    我认为是 IE 驱动程序的问题,尤其是 IEDriverServer,它不能与 IE cookie 一起正常工作。 这是defect in selenium issues.

    【讨论】:

    • 结果可以说是 IE 的主要问题))。它不与js共享cookie,但在请求面板中可以看到它们已提交
    【解决方案2】:

    在解决缺陷之前,您可以从所有区域中删除“保护模式”来解决它。所以:

    • 工具 > Internet 选项。

    • 安全选项卡。对于每个区域:

      • 取消选中“启用保护模式”

    【讨论】:

      猜你喜欢
      • 2019-11-22
      • 2012-11-04
      • 1970-01-01
      • 2017-03-04
      • 1970-01-01
      • 2021-09-19
      • 1970-01-01
      • 2015-12-27
      • 1970-01-01
      相关资源
      最近更新 更多