0

I have xpath : ".//*[@id='ctl00_ctl00_MainContent_ChildContent1_frmClear_dgCashed_ctl65_chkSelect']"

I have value in variable v = 70,

i want to change xpath = ".//*[@id='ctl00_ctl00_MainContent_ChildContent1_frmClear_dgCashed_ctlv_chkSelect']"

I am using xpath 1.0, not xpath 2.0

Can any one please help me

Alan Moore
  • 73,866
  • 12
  • 100
  • 156
Rakesh Kumar
  • 19
  • 1
  • 6

1 Answers1

0

Please check if the below code will work by passing the value v at runtime

public void selectChk(String v) throws Exception {
try {
    driver.findElement(By.xpath(".//* [@id='ctl00_ctl00_MainContent_ChildContent1_frmClear_dgCashed_ctl"+v+"_chkSelect']"))
            .click();
} catch (AssertionError Ae) {
    Ae.printStackTrace();
}
}
Anitha
  • 38
  • 7