我正在尝试访问<a>
具有文本“ 001”的元素。我尝试使用DOM ID,XPath和linkText以及此JavaScript,但找不到。我该怎么做?
这是我用来查找<a>
元素的JavaScript :
driver.findElement(By.linkText("campcode")).click();
这是HTML代码:
<div class="Layout">
<div class="PageTitle">
<div class="Primary-Container Rad5Top">
<div class="Secondary-Container Rad5Top">
<div style="padding-bottom: 15px;">
<div id="SupplyChainTabs">
<div id="opportunitiesDetails">
<table id="ActionLinks" class="ColRow-Table internal-qualification tablesorter" width="100%">
<thead>
<tr>
<th id="CAMPID" width="250" align="left" style="cursor: pointer;">
<th id="CommunityName" width="200" align="left" style="cursor: pointer;">
<th id="ProdCode" width="200" align="left" style="cursor: pointer;">
<th id="Prospects" width="150" align="left" style="cursor: pointer;">
<th id="TS" width="200" align="left" style="cursor: pointer;">
</tr>
</thead>
<tbody>
<tr>
<td valign="top">
<a id = "OB.2000003,OB.2000052,OB.2000053,OB.2000054,OB.2000055,OB.2000056,OB.2000057,OB.2000058" class="" onclick="return ButtonClick(this);" href="#f">001</a> <!-- THE ELEMENT -->
</td>
<td valign="top"> THQS</td>
<td valign="top"> THQS</td>
<td valign="top"> 8</td>
<td valign="top"> 18/09/2014 13:01:13</td>
</tr>
试试这个:
driver.findElement(By.Xpath("//div[@id='opportunitiesDetails']//a[text()='001']")).click();
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句