I am a newbie in Selenium and Java.
- Now, is this code correct. How can I call
findElement()
orfindElements()
method on a single WebElement? I want to store text oftd[1]
node. - Why are we doing Method chaining here?
List<WebElement> sections = driver.findElements(By.tagname("section"));
String td1 = sections.get(0).findElements(By.tagName("tfoot")).get(1).findElements(By.tagName("td")).get(0).getText());
Html DOM code:
<section>
<h2>product table</h2>
<div>
<table class="right">
<tfoot>
<tr class="product">
<td>Product 1
</td>
<td class="rt">323.00</td>
<td class="rt">
6
</td>
<td class="rt">
6
</td>
<td class="rt">
</td>
</tr>
</tfoot>
</table>
</div>
</section>