Search code examples
seleniumjunit4jmenupopup

Selenium does not recognize an element in some of the times


I have an element that selenium doesn't recognize sometimes. I'm using implicitlyWait of 10 seconds and when i'm runing the test sometimes it passed succesfully and the element is recognized, and sometimes it failes with error "No such element". I tried to change the wait time to 20 seconds but it dosen't matter


Solution

  • try using explicit wait :

    WebDriverWait wait = new WebDriverWait(webDriver,60); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div/div/div/div/div[1]/div/div/a/i")));