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

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -