I have a table with 9 rows and 6 columns in my webpage. I want to search for a text \"MakeGoodDisabled-Programwise_09_44_38_461(n)\" and get the xpath of the cell. I have us
Assuming you have an attribute on your element with the name "xpath" you could do the following:
WebElement yourElement = driver.findElement(By.xpath("//td[contains(text(),'MakeGoodDisabled-Programwise_09_44_38_461(n)')]");
String xpathAttributeValue = targetButton.getAttribute("xpath");
Though by the sounds of it you are trying to achieve something else here you have not shared with us yet. Do you want selenium to create an xpath for you? It can't.