0
나는 내 상자에 트래픽이 있는지 확인하고자합니다. 그래서 "총"다른 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를 인쇄하려고해서는 안
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);
감사
감사는 "총"
"9백37킬로바이트"문자열을 반환해야 당신의 WebElement에 gettext에()를 호출 – Farlan
방금 getText()를 사용했는데 좋은 생각 이었지만 번호 (927)를 제로화하고 0과 다른지 확인하는 데 문제가 있습니다. 문자열 데이터 = (driver.findElement (By.xpath ("// tr [@ class = 'right'이고 text() [contains (., 'Download')]/td [2] "))). getText(); \t \t System.out.println (data); –
관련 문제