Why doesn't google chrome print the text() of my XPath query? -
i trying extract texts of xpath query, $x('//td[@class="first"]/a/text()')
in chrome when run command see text
opposed actual text value of anchor links.
when run s.tostring()
seeing [object text],[object text],[object text],[object text]...
.
how can string value in xpath?
because $x()
returns array of html or xml elements matching given xpath expression. means shortcut document.evaluate(). if want exact element, position out of array
$x(element)[0]
this help: https://getfirebug.com/wiki/index.php/$x
if want print(or other stuff) text elements found locator in console - can call foreach
function)
$x('//a/text()').foreach(function(el){console.log(el)})
Comments
Post a Comment