I'm automating a web application using Selenium Webdriver(Java), but having difficulty in storing multiple linktext's. Below is my html code, I have to fetch all email id's to verify before inserting new one.
<tr class="odd" >
<td><input type="radio" name="item" value="52"></td>
<td><a href="/Abcdef/UpdateAction.do?userno=52">abcd.xyz@abc.com</a></td>
<td>Abcd Xyz</td>
<td>internal</td>
</tr>
<tr class="even" >
<td><input type="radio" name="item" value="151"></td>
<td><a href="/Abcdef/UpdateAction.do?userno=151">klmn.opqr@abc.com</a></td>
<td>Klmn Opqr</td>
<td>internal</td>
. .
Likewise it has around 20 linktext's(email id's) and those email id's need to be stored for verification.
Any help would be greatly appreciated
WebElement
variable. Lets call the variable table
List<WebElement> emails = table.findElements(By.partialLinkText("0"));
WebElement
classes getText
on each of item from the list Thanks for your earlier reply.
I used below code to print all linktext's with in table.
WebElement table = driver.findElement(By.id("table_id"));
List<WebElement> emails = table.findElements(By.tagName("a"));
for(WebElement tdElement : emails) {
System.out.println(tdElement.getText());
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.