Selendroid在原生应用

时间:2015-07-02 05:08:21

标签: android testing automated-tests selendroid

我正在使用Selendroid来测试我的android application。它的工作正常,但我遇到了一些问题。一个是当应用程序打开时,一段时间后会加载一个元素,现在我使用Thread.sleep();作为解决方法,但我想使用内置的等待条件,这对我来说根本不起作用。如果我能得到答案,那将会有所帮助。 目前正在实施以下代码

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

1 个答案:

答案 0 :(得分:1)

经过一些研究后,我得到了问题的答案 将上面的代码更改为 WebDriverWait wait = new WebDriverWait(driver, 30); WebElement element =wait.until(ExpectedConditions.presenceOfElementLocated(By .id("imageView_close"))); element.click();