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

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 
主站蜘蛛池模板: 平谷区| 海宁市| 丹阳市| 重庆市| 鹤壁市| 威远县| 梁山县| 尼玛县| 日土县| 高阳县| 壶关县| 镇赉县| 南陵县| 长泰县| 周宁县| 开化县| 全椒县| 黎川县| 安仁县| 旺苍县| 江安县| 深州市| 喀喇沁旗| 木兰县| 正宁县| 贵州省| 肇州县| 永寿县| 长葛市| 玉田县| 岳池县| 忻州市| 崇左市| 黑河市| 永胜县| 南丰县| 乐清市| 堆龙德庆县| 沙洋县| 通道| 南昌市|