Using Selenium WebDriver, I am having a list of all web elements in the page. I want to write one function which will return me the XPath string of passed element.
Call for Function will be like:-
String XpathOfElement = myWebDriver.getXpath(My_Web_Element)
Hint :- I think we can use javascript(using JavaScriptExecuter). But not familiar with javascript.