selenium实现在新窗口打开链接
问题:页面代码中不存在target="_blank",怎么实现点击一个按钮,在新窗口中打开?
WebElement link = element.findElement(By.tagName("a")); String href = link.getAttribute("href"); JavascriptExecutor executor = (JavascriptExecutor) driver; executor.executeScript("window.open('" + href + "')");