isEnabled( ) is the predefined method of Selenium WebDriver, which is used to verify whether the specified form element is either enabled or not.
isEnabled( ) method will return true if the specified form element is enabled else it will return false.
Please go through the comments on the below screenshot to understand the Test Description
Lets Implement the Test on Eclipse IDE:
1. Create a new Project say 'WebDriver-Project40' in Eclipse IDE
2. Configure the Project to work with Selenium WebDriver
3. Create a package say 'package40' under the newly created project.
4. Create a Java Class file say 'Class40' under the newly created package as shown below:
1. Write the following code into the newly created Java Class file as shown below and make sure that you resolve all the errors before going to next step:
2. Write the test method 'isEnabledMethodDemo()' which uses CSS Path Statements for locating the buttons and Text Area field as shown below:
3. Save and Run the 'Class40.java' file by selecting the 'JUnit Test' option and ensure that our Automation Test has verified whether the specified buttons Button1 and Button2 are in enabled or disabled state and also type the results into the Text Area field as shown in the below video:
Watch the below video:
Click here to watch the video.
Download this Project:
Click here to download this project and import into Eclipse IDE on your machine.
Please comment below to feedback or ask questions.
Using isEnabled( ) to find out whether the text box field is in enabled state will be explained in the next post.