pls find the code below:
public static void selectDefinition(String defName)
{
driver.findElement(By.xpath("//table[@id='MainContent_gdvDefs_DXMainTable']//td[text()='"+defName+"']")).click();
}
and
try{
selectDefinition(defdelname);
System.out.println("Definition "+defdelname+" was not removed from the table");
}
catch (Exception ex)
{
System.out.println("Definition "+defdelname+"was removed successfully from the table");
}
in the above code if the "defdelname" is deleted the catch block is not executing but for selectDefinition it is throwing no such element exception.
i am a beginner pls help me out...to solve this issue i want the catch block to be executed any workaround for that?