- 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
推薦閱讀
- RCNP實驗指南:構建高級的路由互聯網絡(BARI)
- 微商之道
- 物聯網網絡安全及應用
- 物聯網時代
- 區塊鏈輕松上手:原理、源碼、搭建與應用
- Metasploit Penetration Testing Cookbook
- Android UI Design
- 從實踐中學習手機抓包與數據分析
- 物聯網工程概論
- INSTANT LinkedIn Customization How-to
- 大型企業微服務架構實踐與運營
- Intelligent Mobile Projects with TensorFlow
- 想象的互動:網絡人際傳播中的印象形成
- 萬物互聯:物聯網核心技術與安全
- Twilio Cookbook(Second Edition)