July 2019
Intermediate to advanced
536 pages
12h 57m
English
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:
@Testpublic 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 ...
Read now
Unlock full access