My =dump(xpathonurl()) returns 3 values, but using [2] or [3] returns blank values

I'm trying to write a formula to find the instances of links which contain "findthis".

The below formula returns 3 values.
=Dump(XPathOnUrl($A2,"//a[@href[contains(.,'findthis')]]","href"))

However, when I use the below formula with [2] instead of dump, I get no errors, but nothing is returned.
=XPathOnUrl($A2,"//a[@href[contains(.,'findthis')]][2]","href")

Does anyone have a clue what I'm doing wrong?

Hi,

If you remove the Dump function SeoTools stops printing the whole array of matching results and only prints the first match of your query. The second element [2] may be empty for some reason.

Do you have an example URL to try on?

URL in A2: https://www.petfinder.com/cats
Dump formula which returns many many links: =Dump(XPathOnUrl($A2,"//a[@href[contains(.,'cat')]]","href"))

As mentioned [1] returns the first value, but [2] or [3] etc are blank. Example code:

=XPathOnUrl($A2,"//a[@href[contains(.,'cat')]][1]","href")
=XPathOnUrl($A2,"//a[@href[contains(.,'cat')]][2]","href")
=XPathOnUrl($A2,"//a[@href[contains(.,'cat')]][3]","href")

I solved my problem by creating this as a function and reading in the whole dump as an array and returning the specified element instead, but I'd like to know why the above doesn't work.

Hmm, I'm not sure. I get the same list of URLs when adding the [1] element