我想确认我的盒子里有流量。所以我想检查“Total”是否与 de 0 不同,但我失败了。
HTML 代码:
<span>
<table>
<tbody>
<tr>
<td class="left">Upload</td>
<td class="right">276 KB</td>
</tr>
<tr>
<td class="left">Download</td>
<td class="right">661 KB</td>
</tr>
<tr>
<td class="left">Total</td>
<td class="right">937 KB</td>
</tr>
<tr>
<td class="left">Duration</td>
<td class="right">5min19s</td>
</tr>
</tbody>
</table>
</span>
我的脚本:
WebElement data = (driver.findElement(By.xpath("//tr[@class='right' and text()[contains(., 'Download')]/td[2]")));
System.out.println(data);
Thread.sleep(3000);
assertTrue(data != null);
谢谢