代码不起作用。 该页面不会在新标签中打开。 该页面在现有选项卡上打开。 没有错 有什么问题吗?
<link href='https://fonts.googleapis.com/css?family=Roboto:400,500,700' rel='stylesheet' type='text/css'>
<link rel='stylesheet' href='http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'>
<form action="test.php">
<div>
<div id='realElements'>
<input type="test" name="test">
</div>
<div id="clonedElements">
Cloned
</div>
<button type="submit">
submit
</button>
<button id="cloneButton" type="script">
Clone
</button>
<button type="button">
type='button'
</button>
<button>
type=null
</button>
</div>
</form>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script>
$(document).ready(function() {
$("#cloneButton").click(function(){
$("#realElements").clone().appendTo("#clonedElements");
});
});
</script>
这是我的代码
driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL +"t");
ArrayList<String> tabs = new ArrayList<String> (driver.getWindowHandles());
driver.switchTo().window(tabs.get(0));