selenium实现在新窗口打开链接

问题:页面代码中不存在target="_blank",怎么实现点击一个按钮,在新窗口中打开?
WebElement link = element.findElement(By.tagName("a"));
String href = link.getAttribute("href");
JavascriptExecutor executor = (JavascriptExecutor) driver;
executor.executeScript("window.open('" + href + "')");
posted @ 2017-06-02 10:49  AlamZ  阅读(2450)  评论(0编辑  收藏  举报