1
我有一個表,表中有這樣的:查找特定使用XPath
<table cellpadding="1" cellspacing="0" width="100%" border="0">
<tr>
<td colspan="7" class="csoGreen" width="120%"><b class="white">Accounts and Payment Methods</b></td>
</tr>
<input type="hidden" name="pageNum" value=""/>
<input type="hidden" name="reload" value=""/>
<tr class="tableCellHeader">
<td nowrap="nowrap"><b></b></td>
<td nowrap="nowrap"><b>Account Number
<br/><br/><span id="accountToggle" style="color:#ff0000"></span></b></td>
<td nowrap="nowrap"><b><center>Amount Due</center></b></td>
<td nowrap="nowrap"><b><center>Due Date</center></b></td>
<td nowrap="nowrap"><b>Enter/Edit<br/>Payment<br/>Amount<span class="red">*</span></b></td>
<td nowrap="nowrap"><b>Enter/Edit<br/>Payment<br/>Date<span class="red">*</span></b></td>
<td nowrap="nowrap"><b>Please select a Payment Method<span class="red">*</span></b></td>
現在,我寫了這一點,它的工作原理:
account_overview_tag.xpath("//td[contains(descendant::center, 'Amount Due')]")
不過,我想以測試它是一個具體的TD例如
account_overview_tag.xpath("//td[2][contains(descendant::center, 'Amount Due')]")
如何讓我的XPATH表達式正常工作?