0

I always encounter this exception during my batch run.

I've already catch the InterruptedException then call the Thread.currentThread.interrupt().

How can I get rid of the sleep interrupted?

I encountered randomly in WebDriverWait. I don't know why it happens.

public boolean isElementVisible(WebElement webElement) {

    boolean isVisible = false;
    try {
        log.info(CHECK_IF_ELEMENT_IS_VISIBLE);
        WebDriverWait wait = new WebDriverWait(driver, 
        CommonConstants.DEFAULT_TIMEOUT_IMPLICITWAIT);
        Wait.until(ExpectedConditions.visibilityOf(webElement));
        isVisible = true;
    } catch (Exception e) {
        log.error(ELEMENT_NOT_FOUND, e);
    }
    return isVisible;
}
Bish Ngot
  • 1
  • 3
  • Are you using both explicit (`WebDriverWait`) and implicit waits? This is warned against in the Selenium docs. I'm not sure if that's your issue but it can cause weird things to happen. You also need to take a minute to clean up your code. It won't compile as is because of typos and there are extra spaces where there shouldn't be. – JeffC Jul 26 '17 at 02:54
  • 1
    You know you can just check `element.isDisplayed()`, right? That will make this whole function obsolete. – JeffC Jul 26 '17 at 02:59
  • "Are you using both explicit (WebDriverWait) and implicit waits?" > Yes, we are using both. But it's weird because it occurs only when we run all out test case (239 test case). We are not encountering this If we run below 100 test case. We will try to use only the explicit waits – Bish Ngot Jul 26 '17 at 14:01

0 Answers0