I experience very strange problem: I have some flow (Login) and sometimes it passed and sometimes not, due to not found element exception, every time it fails it’s for the same element.
I added “Thread.sleep” for 30 seconds and then it passed well, but I don’t like this workaround, as the test take too long.
Also, sometimes the test passed 5 times in a row without the thread.sleep, but just after it fails everytime.
Thread.sleep(30000); WebElement we = driver.findElementById("com.glucome.android.glucomeandroidapp6:id/passwordText"); we.click(); we.sendKeys(password); CodePage codePage = new CodePage(driver);
For example here, I use find by instead of initializing the page itself (CodePage contains the problematic element).
UPDATE: it doesn’t work consistenly even with the thread.sleep.
Tried with Wait:
WebDriverWait wait = new WebDriverWait(driver, 30); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("com.glucome.android.glucomeandroidapp6:id/passwordText")));
I get timeout exception.