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

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 
主站蜘蛛池模板: 鸡东县| 兖州市| 罗山县| 黄平县| 盖州市| 富锦市| 呼和浩特市| 夏津县| 修武县| 中牟县| 容城县| 都匀市| 乐安县| 松阳县| 阿拉尔市| 金川县| 广汉市| 黄山市| 哈密市| 从化市| 沙坪坝区| 兰州市| 武宁县| 桐梓县| 大港区| 丹东市| 灵川县| 开远市| 固镇县| 洪江市| 芒康县| 浮山县| 隆回县| 科技| 和平区| 无棣县| 庆元县| 海盐县| 孙吴县| 吴桥县| 英超|