Until code not working

I have this code and it can’t find element and it appears to be in infinite loop then it times out.
Any idea what I am doing wrong here?

driver.findElementByClassName(“android.widget.ImageView”).click();
WebDriverWait wait = new WebDriverWait(driver, 360);
wait.until(new Predicate() {
@Override
public boolean apply(WebDriver input) {
return input.findElement(By.name(“Login”)) != null;
}
});

@starbaek, the wait loop will repeat until either the timeout value is exceeded or
input.findElement(By.name(“Login”)) != null
evaluates to true.

Since the findElement call must be returning false, check if there is an element on the screen* with the text or description “Login”. If the element is visible, you will need to check your appium server log to find out why it’s not being detected.

  • On Android, the object has to be visible in order to be detected, whereas on iOS, the object can be detected even if it is not visible on the screen.

thank you. I had to put thread.sleep then all worked!