The web application which I'm working on has a lot of charts with random data and during first login it takes about a minute to refresh all data. When I try to click some button, I'm getting "ElementClickInterceptedException". I tried explicit and fluent waits, and it not helped. The only solution which helped me to fix this issue using try-catch with recursion:
public static void interceptedClick(WebElement locator) {
try {
locator.click();
} catch (ElementClickInterceptedException e) {
GenericMethods.hardDelay(5000); //Delay between attempts
interceptedClick(locator); //Recursion
}
}
My question: Is it acceptable approach, or there is another better way to handle this exception?