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

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 
主站蜘蛛池模板: 城步| 鸡东县| 五华县| 岗巴县| 宁陕县| 华坪县| 万宁市| 余庆县| 琼中| 武功县| 高要市| 滁州市| 河东区| 惠东县| 台北市| 水城县| 延寿县| 武强县| 枣阳市| 吴旗县| 永清县| 安徽省| 庆安县| 乌兰察布市| 定兴县| 锡林浩特市| 巢湖市| 抚州市| 兴化市| 保德县| 赣榆县| 阜阳市| 绥化市| 宝兴县| 桂阳县| 绍兴市| 黑龙江省| 桃园县| 云霄县| 新竹县| 泊头市|