标签:
AndroidDriver driver = new AndroidDriver();
driver.get("http://m.taobao.com");
WebElement inputBox = driver.findElement(By.id("J_SKey"));
inputBox.sendKeys("1");
new WebDriverWait(driver, 10).until (new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
Boolean result = false;
try {
driver.findElement(By.xpath("//div[@class=‘suggest‘]//li"));
result = true;
} catch(Exception e){
}
return result;
}
});
assertTrue(driver.findElement(By.xpath("//div[@class=‘suggest‘]//li")).getText().contains("1"));
selenium经过WebDriverWait实现ajax测试
标签:
原文地址:http://www.cnblogs.com/timdes/p/5101648.html