WebDriver Commands - To Check Visibility of Web Elements

As you all are aware, the use of selenium webdriver for testing web based applications is increasing and selenium has become the most widely used test automation tool in the world. In such a scenario, we are discussing various aspects and functionalities of selenium. In the earlier chapters we have discussed select class and in this chapter, we are discussing different webdriver commands that are used to check the visibility of web elements.

Determining the visibility scope of an element is an important process in the software testing and various webdriver commands such as “is Selected ()”, “is Enabled () and “is Displayed ()” are used for that purpose. Visibility preferences are different based on the types of web elements upon which some actions are to be performed and W3C has specifications for that which has been followed by the webdriver.

AS mentioned earlier, webdriver has three different methods to check the visibility of the elements.

WebDriver Commands

Is Displayed ()

Is Displayed () method is used for verifying an element present in the web page. A true value will be returned if the web element is present on the web page and a false value will be returned if it is not present. This method can be used for verifying the visibility of any type of elements and not restricted to any one or two types of elements.

Is Enabled ()

Is Enabled () method is to check whether the web elements in question are enabled or disabled on the web page. As in the case of “is Displayed (), a true value will be returned if the element is enabled and a false value will be returned if disabled. This is more significant in scenarios where certain conditions have to be fulfilled for an element to get enabled.

Is Selected ()

Is Selected () method is used for checking whether an element is selected or not. This method is mostly used with radio buttons, dropdowns, and checkboxes. If an element is selected, the method will return a true value and if not a false value.

Conclusion

This article or this portion of the tutorial contains only the basics about different webdriver commands. Learning webdriver commands is essential to master the technology of selenium and to become a professional software tester. This portion will be taught in detail in tutorials with relevant examples.

Leave a Reply

Your email address will not be published. Required fields are marked *