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
The question which you asked does not make any sense to me. I guess there might be a strong reason for you to 'want to do it' !
Your line of code
String xpath = driver.findElement(By.name(test)).getAttribute("xpath");
will not return anything because there is no attribute 'xpath' in html elements. Please get your basics clear on to what xpath means??
if i have an html element as shown below
i can get the values of attribute by using
driver.findElement(By.name("username").getAttribute("value"); // returns 'Name'
This will give me value of 'value' attribute
or
driver.findElement(By.name("username").getAttribute("readonly"); // returns 'readonly'
same as above !