How to solve stale element exception I have already tried with web driver wait and try n catch but still getting the same. It is clicking the button also which I am trying to click in a table and also navigating to next page.
This is the code for the same:
for(int cnum=1;cnum<=1;cnum++)
{
System.out.println("SOURCE_TABLE_ID-> " + columns.get(1).getText() + "\t ||" +"\t SOURCE_TABLE_NAME-> "+ columns.get(2).getText());
String beforexpath = "//*[@id='root']//table/tbody/tr[";
String afterxpath = "]/td[3]";
for (int i=1;i<=rnum;i++)
{
String SourceTableName= driver.findElement(By.xpath(beforexpath+i+afterxpath)).getText();
if(SourceTableName.contains("bank_data"))
{
WebElement sourcetable_element =new WebDriverWait(driver, 70).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id='root']//table/tbody/tr["+i+"]/td[5]/div[@class='glyphicon glyphicon-plus']")));
sourcetable_element.click();
break;
}
else
{
System.out.println("does not starts with B so not clicking");
}