Search code examples
androidtestingautomated-testsselendroid

Selendroid wating for an element in native app


I am using Selendroid to test my android application. Its working fine but I am having a couple of problems. One is that when the app is opened an element is loaded after sometime, for now I am using Thread.sleep(); as a work around but I want to use built in waiting conditions which are not at all working for me. Please if I can get a answer to that it will be helpful. currently am implementing the following code

WebElement referImage = waitForElement(By.id("imageView_close"),30,driver); referImage.click();


Solution

  • I got the answer to my question after some more research changed the above code to WebDriverWait wait = new WebDriverWait(driver, 30); WebElement element =wait.until(ExpectedConditions.presenceOfElementLocated(By .id("imageView_close"))); element.click();