M在验证文本“保存权限”是否突出显示时遇到问题。
<div class="o-grid">
<div class="o-grid__col o-grid__col--1-of-1">
<div class="c-page-actions">
<div class="c-page-actions__primary">
<button id="btnSavePermission" class="c-button c-button--big-text c-button--icon-right c-button--hug-right" data-button-enabled-when-form-edited="" disabled="">
<div class="c-button__inner-wrapper">
Save permissions
<svg class="c-icon c-icon--color-yellow" aria-hidden="true">
</div>
任何人都可以帮我解决这个问题。
答案 0 :(得分:0)
WebElement btnSavePerm = driver.findElement(By.id("btnSavePermission"));
if( btnSavePerm != null && btnSavePerm.isDisplayed() ){
if(!btnSavePerm.getAttribute("disabled").equals(""))
{
System.out.println("button is highlighted or enabled");
}
else{
System.out.println("button is not highlighted or enabled");
}
}