1

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?

cryptus
  • 23
  • 6
  • Please refer to the following [post](https://stackoverflow.com/a/60687304/5944412) to get your issue resolved. – Bipin Kumar Chaurasia Dec 20 '21 at 18:30
  • @BipinKumarChaurasia I tried all solutions from post and only one (wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath...) fix my issue. I put 120 seconds for explicit wait and somehow selenium wait all 120 seconds even if element invisible after 65. – cryptus Dec 20 '21 at 19:29

0 Answers0