How to open a new tab using Selenium WebDriver?

后端 未结 29 2832
野的像风
野的像风 2020-11-22 04:40

How to open a new tab in the existing Firefox browser using Selenium WebDriver (a.k.a. Selenium 2)?

29条回答
  •  一个人的身影
    2020-11-22 05:35

    Due to bug in https://bugs.chromium.org/p/chromedriver/issues/detail?id=1465 even though webdriver.switchTo actually does switch tabs, the focus is left on the first tab. You can confirm this by doing a driver.get after the switchWindow and see that the second tab actually go to the new URL and not the original tab.

    Work around for now is what @yardening2 suggested. Use js to open an alert and then use webdriver to accept it.

提交回复
热议问题