Get an Element by XPath

Use the following JavaScript, in the console works too!

function getxpath(xpath, rel) { if (rel === undefined) rel = document; return document.evaluate(xpath, rel, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; }