in reply to Re^3: Some issues with WWW::Mechanize::Firefox->xpath() method (xpath 1.0)
in thread Some issues with WWW::Mechanize::Firefox->xpath() method

You are using findnodes, but there is no node corresponding to the substring. Use find instead:
print for $dom->find(q{ substring(//p,1,4) });
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^5: Some issues with WWW::Mechanize::Firefox->xpath() method (xpath 1.0)
by Corion (Patriarch) on Apr 02, 2013 at 11:30 UTC

    For reference, WWW::Mechanize::Firefox uses document.evaluate() to execute an XPath query. I don't know how it relates to ->findNodes and ->find, but the return value will always be DOM nodes.

    Javascript in MozRepl::RemoteObject:

    ... var xres = doc.evaluate(q,ref,null,XPathResult.ORDERED_NODE_SNAPSHOT_T +YPE, null ); ...
Re^5: Some issues with WWW::Mechanize::Firefox->xpath() method (xpath 1.0)
by Anonymous Monk on Apr 02, 2013 at 11:35 UTC

    You are using findnodes, but there is no node corresponding to the substring. Use find instead:

    Well that certainly works :) but the explanation doesn't make sense to me -- what is a text literal if not a text node?

    This whole time I've been thinking the two functions were interchangeable, if findnodes can't deal with this, it should reject the xpath, not do nothing, but yeah, I'm confused