请找到HTMl代码
<input type="password" maxlength="20" id="txtRegPassword" data-bind="value: Password, valueUpdate: 'afterkeydown',qtipValMessage:Password" class="input-txt ErrorControl" data-orig- title="" data-hasqtip="3" oldtitle="Password doesn't meet the Password Policy." title="" aria-describedby="qtip-3">我的要求是获取oldtitle值(“密码不符合密码策略”)
以下是我的代码(Java),但我得到的值是空值
String Validationmessagepwd = driver.findElement(
By.cssSelector("input#txtRegPassword")).getAttribute("oldtitle");上述代码会产生一个空值
注意: oldtitle (动态)属性绑定与KO (Knockout JS)绑定,所以我不能得到这个,请指导
发布于 2014-04-22 02:25:09
尝尝这个。我们循环最多5秒,每隔500ms轮询一次,直到apply方法返回true。
WebDriverWait wait = new WebDriverWait(driver,5).until(new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver driver) {
WebElement inputElement= driver.findElement(By.cssSelector("input#txtRegPassword"));
if(inputElement.getAttribute("oldtitle") == null)
return false;
} else {
return true;
}
});https://stackoverflow.com/questions/23196652
复制相似问题