My xpath =
".//*[@id='ctl00_ctl00_MainContent_ChildContent1_frmClear_dgCashed']/tbody/tr[67]]/td[1]/strong"
where value 67 keeps on changing. How can i use Regular expression so that i can read the value of this element?
Please Need help,Thanks
My xpath =
".//*[@id='ctl00_ctl00_MainContent_ChildContent1_frmClear_dgCashed']/tbody/tr[67]]/td[1]/strong"
where value 67 keeps on changing. How can i use Regular expression so that i can read the value of this element?
Please Need help,Thanks
As I don't know your HTML, it's not completely clear to me what you're trying to achieve. But if you say you want to find row #67 and the total number is also 67, then I assume you are trying to find the last row in the table!?
If this is case, instead of stating tr[67]
, you should simply use tr[last()]
.
The below link is similar one as discussed,
how to pass value from valraible in to xpath
public void selectTableRow(String v) throws Exception {
try {
driver.findElement(By.xpath("".//*[@id='ctl00_ctl00_MainContent_ChildContent1_frmClear_dgCashed']/tbody/tr["+v+"]]/td[1]/strong".click();
}
catch (AssertionError Ae)
{
Ae.printStackTrace();
}
}