Controlling firefox tabs in selenium

后端 未结 2 1112
醉酒成梦
醉酒成梦 2020-12-11 12:56

According to the window_handles documentation:

window_handles

Returns the handles of all windows within the current session.<

相关标签:
2条回答
  • 2020-12-11 13:29

    Only the top level browser window has an HWND. Tabs don't have their own HWNDs. For more clarification refer here.

    0 讨论(0)
  • 2020-12-11 13:33

    Selenium have a Handle for Windows not for tabs. you can also work on the tabs with some code like this

    ArrayList<String> tabs2 = new ArrayList<String> (driver.getWindowHandles());
    driver.switchTo().window(tabs2.get(0));
    

    this will allow you to work on Tab 1 and

    driver.switchTo().window(tabs2.get(1));
    

    will allow you to work on the second tab.By this way you can handle tab in Browser.

    0 讨论(0)
提交回复
热议问题