in reply to Having trouble getting WWW::Mechanize::Firefox->xpath to return expected results

Most likely it is something with your use of xpathResult('STRING_TYPE'.... Also, there is no ->mech() method in WWW::Mechanize::Firefox.

Personally, I would recommend simply retrieving the links and extracting the href attribute on the Perl side:

my @links = ...('//div[@id="CID60"]/ol/li/a', all => 1); my @href = map { $_->{href} } @links;

Replies are listed 'Best First'.
Re^2: Having trouble getting WWW::Mechanize::Firefox->xpath to return expected results
by nysus (Parson) on Apr 03, 2016 at 19:55 UTC

    Thanks Corion!

    The mech method was a bad edit on my part. Fixed.

    So your code worked, but I'm not quite sure how or why $_->{href} extracted the href property from @links. When I dump @links I get some really hairy looking objects. That's why I tried converting them to a string in the first place.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
    $nysus = $PM . ' ' . $MCF;
    Click here if you love Perl Monks

      The objects look so hairy because they live in Firefox and have some Perl code that fetches the values from Firefox.