WebDriver.getWindowHandle() method

后端 未结 5 1242
春和景丽
春和景丽 2020-12-18 07:49

I\'m new to Selenium learning. WebDriver.getWindowHandle() documentation is not very clear to me and the example is not working as given in the book, so I thought of confirm

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-18 08:08

    When you open the new window, the WebDriver doesn't automatically switch to it. You need to use the switchTo() method to switch to the new window, either using the name of the new window, or its handle (which you can get with getWindowHandles() and searching for the one that's not the current window).

提交回复
热议问题