Solution 1 :

According to the doc you have to use findElements with a s. If I modify a bit your XPath, you can have something like this :

const nodes = xpath.fromPageSource(html).findElements("//a[@class='classifiedTitle']");
console.log("Number of ads found:", nodes.length);
console.log("Link[0]:", nodes[0].getAttribute("href"));
console.log("Link[1]:", nodes[1].getAttribute("href"));

Of course it’s better if you write a loop to print all the links. Something like :

for (let x = 0; x < nodes.length; x++) {

Problem :

I need to get all the links in the table on this page :

I am using this library:

The issue is that when I print results it only gives me the first link.

let results = xpathT.fromPageSource(data).findElement("//tbody[@class='searchResultsRowClass']//a");
console.log("HERE NOSEDSS");
console.log("The href value is:", results[1].getAttribute("href"));

How do I get all the links?