following-sibling
添加具有特定版本的<td>
并使用该元素中的preceding
<tr class="dark">
<td width="10%" valign="top">
<input id="b5c7704b641c4e290164831754a200d1" name="rowCheckBox" value="BCM$b5c7704b641c4e290164831754a200d1$$$ACCEPTED$Released$false" type="radio" valign="top" onclick="javascript:handlebuttons()" />
</td>
<td style="word-wrap : break-word ;overflow:hidden;" title="AttachmentService" width="30%" valign="top">
<img src="images/service_released.PNG" onmouseover="javascript:showToolTip('Released',this)" onmouseout="hideToolTip()" style="padding-right:5px;" width="18px" height="18px" border="0" align="top" />AttachmentService</td>
<td style="word-wrap : break-word ;overflow:hidden;" width="15%" valign="top">SOAP</td>
<td style="word-wrap : break-word ;overflow:hidden;" width="15%" valign="top">Sync</td>
<td style="word-wrap : break-word ;overflow:hidden;" width="15%" valign="top">1.17</td>
<td width="15%" valign="top">Released</td>
<td style="word-wrap : break-word ;overflow:hidden;" width="15%" valign="top">ACCEPTED</td>
</tr>
我正在使用硒,并且希望它单击版本'AttachmentService'
的'1.17'
之前的单选按钮>
我尝试了以下操作:
driver.findElement(By.xpath("//td[contains(@title, AttachmentService')]//preceding::input[1]"))
但是我想包含
1.17
,因为我们有很多AttachmentService
,它们的版本不同,例如1.15,1.16,1.17
如何处理?
following-sibling
添加具有特定版本的<td>
并使用该元素中的preceding
String version = "1.17";
driver.findElement(By.xpath("//td[contains(@title, 'AttachmentService')]/following-sibling::td[.='" + version + "']//preceding::input[1]"));
following-sibling
添加具有特定版本的<td>
并使用该元素中的preceding
following-sibling