How to open a new tab using Selenium WebDriver?

后端 未结 29 2457
野的像风
野的像风 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:26

    To open new window in Chrome Driver.

    //The script that will will open a new blank window
    //If you want to open a link new tab, replace 'about:blank' with a link
    String a = "window.open('about:blank','_blank');";
    ((JavascriptExecutor)driver).executeScript(a);
    

    For switching between tabs, Read here

提交回复
热议问题