问题
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