getWindowHandles return 如果在单个 window 中打开多个选项卡,则一个 window 句柄

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

getWindowHandles returns 在 firefox 浏览器中的错误值。当我在一个 firefox window 中打开多个选项卡并试图找出 window 句柄的数量以检查天气时它是 returning 正确的值,getWindowHandles 仍然是 returns 值单身 window。如果我在新的单独 window 中打开选项卡,getWindowHandles return 正确的值。 这是一个错误吗?

我对 chrome 进行了相同的尝试,并且 I.E 按预期工作。 火狐版本:37 硒版本:2.45 OS:Mac 和 Windows

代码我已经试过了,参考附件中的代码。

根据 FirefoxDriver 团队的说法,这一切正常。在 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.