2017-04-21 77 views
0

我在網站裏的標籤和我不能改變標籤,使用XPath已經嘗試過,目前看起來是這樣的:改變與硒的webdriver標籤在Firefox

Select objSelect = new Select(objdriver.findElement(By.xpath("//*[@id='navigation']/li[2]/a"))); 
WebElement navigation = objdriver.findElement(By.xpath("//*[@id='navigation']/li[2]/a")); 

HTML代碼:

<div> 
<nav class="navbar navbar-default" role="navigation"> 
<div class="container"> 
<div> 
<div class="pull-right padding-top"> 
<a href="http://www.mineotaur.org>"> 
</div> 
<ul id="navigation" class="nav navbar-nav"> 
<li class="active"> 
<a data-toggle="tab" href="#genewise">Gene-wise scatterplot</a> 
</li> 
<li> 
<a data-toggle="tab" href="#groupwiseDistributionForm">Gene-wise distribution</a> 
</li> 
<li> 
<a data-toggle="tab" href="#cellwise">Cell-wise scatterplot</a> 
</li> 
<li> 
<a data-toggle="tab" href="#cellwiseDistribution">Cell-wise distribution</a> 
</li> 
<li id="toolNav" class="disabled"> 
<a data-toggle="tab" href="#tools">Tools</a> 
</li> 

感謝您的回答!

+1

分享'HTML'代碼樣本相同,異常日誌 – Andersson

回答

0

您可能需要使用這種過度的驅動程序通過,但是這是我使用

openTabElement.click(); 
ArrayList<String> tabs = new ArrayList<String> (driver.getWindowHandles()); 
driver.switchTo().window(tabs2.get(1)); 
driver.close(); 
driver.switchTo().window(tabs2.get(0));