Question: can we get xpath from webelement?
Answer: Assuming you have an attribute on your element with the name "xpath" you could do the following: WebElement yourElement = driver. findElement(By. ... getAttribute("xpath");