getWindowHandles return one window handle if multiple tabs are open in single window

不想你离开。 提交于 2020-01-04 02:29:07

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/33874788/getwindowhandles-return-one-window-handle-if-multiple-tabs-are-open-in-single-wi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!