Open and close new tab with Selenium WebDriver in OS X

前端 未结 5 535
北恋
北恋 2021-01-11 16:23

I\'m using the Firefox Webdriver in Python 2.7 on Windows to simulate opening (Ctrl+t) and closing (Ctrl + w) a new tab.

5条回答
  •  终归单人心
    2021-01-11 16:40

    There's nothing easier and clearer than just running JavaScript.

    Open new tab: driver.execute_script("window.open('');")

提交回复
热议问题