Overview of WebElement commands

WebDriver API provides a rich set of commands to deal with different elements on the web page like text field, text area, radio button, checkbox, drop down menu etc.

WebElements commands can be categorized into various categories :

  1. Basic WebElement commands
  2. Handling Radio button
  3. Handling Checkbox
  4. Handling Drop down menu

 

What is WebElement?

WebElement is an interface which extends SearchContext interface. It contains all the methods declared related to handling elements on web page.

Where these abstract methods are implemented?

Since, WebElement is an interface, it does not provide implementation of the same. So, the first question comes into mind is where these methods are implemented.

RemoteWebElement class is the destination where all the methods defined by WebElement are implemented.

 

public class RemoteWebElement implements WebElement, FindsByLinkText, FindsById,                                                                                                    FindsByName,FindsByTagName,  FindsByClassName, FindsByCssSelector, FindsByXPath,  Locatable {

}

 

How to see all the methods/ commands of WebElement?

To see all the methods of WebElement interface, have a look at below snapshot.

WebElementCommands1

WebElementCommands2

As shown in the snapshot, Eclipse will provide the documentation of all the commands.

But, before moving on to learning the commands of WebElement, it is must to have a clear understanding of findElement and findElements methods and how to locate the element on the web page (By strategy).

Visit the link to understand the working of findElement and findElements methods.

Click here to know the difference between findElement and findElements methods.

To understand different ways of locating the element on web page visit the link.

Hope it helps you!!

Cheers 🙂

Advertisements

#types-of-webelement-commands, #webelement-commands