- 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
推薦閱讀
- 解析QUIC/HTTP3:未來互聯網的基石
- Spring Cloud微服務架構進階
- 局域網組建、管理與維護項目教程(Windows Server 2003)
- Go Web Scraping Quick Start Guide
- 計算機網絡與通信(第2版)
- Microsoft Dynamics CRM 2011 Applications(MB2-868) Certification Guide
- 網絡基礎與網絡管理項目化教程
- Getting Started with Memcached
- 設備監控技術詳解
- Hands-On Bitcoin Programming with Python
- 精通SEO:100%網站流量提升密碼
- Building RESTful Web Services with .NET Core
- 計算機通信網絡安全
- 算力網絡:云網融合2.0時代的網絡架構與關鍵技術
- 一本書讀懂移動物聯網