Element not found even when it's there


#1

Hey guys,

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.
Please advice.

ANOTHER EDIT:
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.


#2

In this scenario always take help of arc way of interacting with the app.

If you able to interact with app and do actions properly then it’s definitely timing issue even if it still keeps on failing attach appium server log so that we can look what’s happening

You can find more info how to use this ruby library under my blog section

Method 2: ( Appium Ruby Console ) <<<


#3

Thanks for your comment.
I will have a look using arc, but since I am not ruby developer, it will be tricky to find out the right syntax.


#4

Even I don’t know much of Ruby as I code in Java. But this is most easy way to interact with AUT in interactive mode and save some headaches :slight_smile:


#5

That means element is not clickable or DOM is not able to locate that element.Please check element is Displayed or enabled or not


#6

Do you get any solution for Timeout exception, I am getting same issue and spent almost a day but not able to fix.


#7

i am having the same issue on android. using appium 1.8.1.