Everyone knows to find a element using Xpath, there are multiple tools there to find the element. But I have the element. But how to find the xpath for that element using javascript. Is there any way to find the Xpath.
document.addEventListener('click', function(e) {
e = e || window.event;
var target = e.target || e.srcElement,
text = target.textContent || target.innerText;
alert(target.srcElement);
}, false);