如果在单个窗口中打开多个选项卡,getWindowHandles将返回一个窗口句柄 [英] getWindowHandles return one window handle if multiple tabs are open in single window
问题描述
getWindowHandles
在firefox浏览器中返回不正确的值。当我在一个firefox窗口中打开多个选项卡,并试图找出窗口句柄的数量来检查天气,它返回正确的值,getWindowHandles仍然返回值作为单个窗口。如果我在新的单独的窗口中打开选项卡,getWindowHandles返回正确的值。
这是一个错误吗?
我试着和chrome一样,而且它的工作和预期的一样。
Firefox版本:37
Selenium版本:2.45
操作系统:Mac和Windows
我已经试过代码根据FirefoxDriver小组的说法,这是按照预期工作的。在 https://github.com/SeleniumHQ/selenium/issues/1614 上查看他们的回复:b
$ b
在点击一个打开一个新窗口的链接的情况下(通过target = _blank或类似的机制,驱动程序将知道试图控制点击(或命令+点击)链接以在新标签中打开链接的情况绕过了驱动程序创建新的顶级浏览上下文的机制,因此,这样的新标签或窗口是不是由驱动程序管理的。
getWindowHandles
returns incorrect value in firefox browser. When I opened multiple tabs in a single firefox window and tried to find out the number of window handles to check weather it's returning correct value, getWindowHandles still returns value as single window. If I open the tab in new separate window, getWindowHandles return correct value.
Is this a bug?
I tried the same with chrome and I.E its working as expected. Firefox version: 37 Selenium version: 2.45 OS: Mac and Windows
I have already tried the code refer the code in attachment.
This is working as intended according to the FirefoxDriver team. See their response at https://github.com/SeleniumHQ/selenium/issues/1614:
In the case of clicking on a link that opens a new window (via target=_blank or a similar mechanism, the driver will know about those windows or tabs. The case of attempting to control+click (or command+click) a link to open it in a new tab circumvents the driver's mechanism for creating new top-level browsing contexts. Thus, such new tabs or windows are not managed by the driver.
这篇关于如果在单个窗口中打开多个选项卡,getWindowHandles将返回一个窗口句柄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!