Looking for a way to extract the text from an Xpath using javascript.
Example:
Xpath: Sometext
Want to return the value: Sometext.
Tried something like this with no luck.
var x_path = ‘my_xpath’;
var result = document.evaluate(x_path,document, null, XPathResult.STRING_TYPE, null);
console.log(result);
Output is just {}.