使用Selenium InternetExplorerDriver获取所有iframe中设置的所有cookie [英] Getting all the cookies set in all iframes using Selenium InternetExplorerDriver

查看:298
本文介绍了使用Selenium InternetExplorerDriver获取所有iframe中设置的所有cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的问题:

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

I use the Selenium InternetExplorer Driver to open a new browser window with a button click:

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

新的浏览器窗口打开,并且在该窗口的其中一个框架中,自动提交表单设置了Cookie的数量。

The new browser window opens and in one of the frames in this window an auto-submit form sets a number of cookies.

首先,我将焦点更改到新窗口:

First I change focus to the new window:

driver.switchTo().window(popupHandle);

然后我将焦点更改为通过自动提交表单设置了新Cookie的框架

Then I change focus to the frame that had the new cookies set via the auto-submit form

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

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

now when I iterate through all the cookies in the driver:

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

驱动程序不显示使用自动提交表单设置的cookie,但是我可以清楚地看到

the driver does not show the cookies that was set with the auto-submit form, yet I can clearly see that the cookies have been set in IE using httpAnalyzer.

这些cookie也是从本地域而不是第三方设置的。

The cookies were also set from the local domain and not a third party.

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

So I can see the cookies in IE but the driver can not see them?

推荐答案

问题我认为使用IE驱动程序时,尤其是使用IEDriverServer时,它不能与IE cookie一起正常工作。
这是硒问题中的缺陷。

Its problem with IE Driver, I think, especially with IEDriverServer, it can't work properly with IE cookies. Here is the defect in selenium issues.

这篇关于使用Selenium InternetExplorerDriver获取所有iframe中设置的所有cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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