官术网_书友最值得收藏!

The isEnabled() method

The isEnabled action verifies whether an element is enabled on the web page and can be executed on all the WebElements. The API syntax for the isEnabled() method is as follows:

boolean isEnabled()

The preceding method returns a Boolean value specifying whether the target element is enabled on the web page. The following is the code to verify whether the Search box is enabled, which obviously should return true in this case:    

@Test
public void elementStateExample() {
WebElement searchBox = driver.findElement(By.name("q"));
System.out.println("Search box is enabled: "
+ searchBox.isEnabled());
}

The preceding code uses the isEnabled() method to determine whether the element is enabled on a web page. The preceding code returns true for the Search box:  

Search box is enabled: true 
主站蜘蛛池模板: 丰顺县| 禄劝| 梧州市| 灵山县| 红安县| 泰顺县| 西乌珠穆沁旗| 新津县| 五华县| 兴隆县| 荔浦县| 尚志市| 蒲城县| 郴州市| 黑龙江省| 镇安县| 上杭县| 门源| 灵宝市| 江华| 浦县| 乌苏市| 鄄城县| 定西市| 普陀区| 凭祥市| 准格尔旗| 措美县| 镇原县| 温泉县| 喀什市| 天峨县| 葵青区| 道真| 棋牌| 黔南| 石泉县| 安化县| 若尔盖县| 定边县| 共和县|