以下XPath没有捕获任何错误消息。我想在提交空白页时捕获三个错误消息。此外,声明失败。
**My code is here:**
java.util.List <WebElement> elements = dr.findElements(By.xpath("//*
[@id='mssg_errors']")); System.out.println();
Assert.assertTrue(elements.get(0).equals("Error message1"));
Assert.assertTrue(elements.get(1).equals("Error message2"));
Assert.assertTrue(elements.get(2).equals("Error message3"));
**Messages are to be captured from a table:**
<table width="100%" border="0" cellspacing="0" cellpadding="0"
id="mssg_errors" name="list_errors">
<tbody>
<tr class="whiterow" id="field2_error" style="visibility: visible;
display: block;">
<td class="contentNeg">Error message1.</td>
</tr>
<tr class="whiterow" id="field3_error" style="display: block;
visibility: visible;">
<td class="contentNeg">Error message 3.</td>
</tr>
<tr class="whiterow" id="field1_error" style="display: block; visibility:
visible; font-weight: normal;">
<td class="contentNeg">Error message 1.</td>
</tr>
</tbody>