- Selenium WebDriver 3 Practical Guide
- Unmesh Gundecha Satya Avasarala
- 130字
- 2021-08-13 16:08:11
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
推薦閱讀
- 廣電5G從入門到精通
- 物聯(lián)網(wǎng)信息安全
- 計(jì)算機(jī)網(wǎng)絡(luò)工程實(shí)用教程(第2版)
- 2018網(wǎng)信發(fā)展報(bào)告
- 物聯(lián)網(wǎng)之霧:基于霧計(jì)算的智能硬件快速反應(yīng)與安全控制
- Building Web Applications with ArcGIS
- 網(wǎng)管工具使用與技巧大全
- Learning Windows 8 Game Development
- 工業(yè)互聯(lián)網(wǎng)創(chuàng)新實(shí)踐
- 物聯(lián)網(wǎng)場(chǎng)景設(shè)計(jì)與開發(fā)(初級(jí))
- 局域網(wǎng)組成實(shí)踐
- 組網(wǎng)技術(shù)與網(wǎng)絡(luò)管理
- TCP/IP基礎(chǔ)(第2版)
- 一本書讀懂TCP/IP
- 移動(dòng)互聯(lián)網(wǎng)新思維