I am building a web-scraper using Java and Javafx, where I am using getbyXPath to get Html elements. As shown in the Image of Html source code for the webpage, I want to get the <td>
elements containted in each <th>
element.
This is a part of my code I'm using:
...
List<?> t = (List<?>) e.getByXPath(".//th");
for (HtmlElement et : (List<HtmlElement>)t) {
if (et.asText().equals("ATTRIBUTES")) {
HtmlElement td = (HtmlElement) et.getFirstByXPath(".//td");
...
However, with this code, I get null
as the value in td. What am I doing wrong?