Javatpoint Logo
Javatpoint Logo

Selenium WebDriver - WebElement Commands

Before proceeding with this section, first we should know the basic terminology related to web elements in WebDriver.

What is Web Element?

The term web element refers to a HTML element. The HTML documents are composed of HTML elements. It consists a start tag, an end tag and the content in between. For instance, a HTML element is written as: "<tagname> content </tagname>"

In WebDriver, we have several commonly used web element commands and actions. The following screenshot displays the eclipse web element command panel.

Selenium WebDriver - WebElement Commands

Note: To get the web element object, we have to write the statement as:

Here, the UserName is the value of the id attribute, used as a unique identification for the desired web element.

Given are some of the most commonly used WebElement commands for Selenium WebDriver.

1. Clear Command

Method:

Command:

Code snippet:

2. Sendkeys Command

Method:

Command:

Code snippet:

3. Click Command

Method:

Command:

Code snippet:

4. IsDisplayed Command

Method:

Command:

Code snippet:

5. IsEnabled Command

Method:

Command:

Code snippet:

6. IsSelected Command

Method:

Command:

Code snippet:

7. Submit Command

Method:

Command:

Code snippet:

8. GetText Command

Method:

Command:

Code snippet:

9. GetTagName Command

Method:

Command:

Code snippet:

10. getCssValue Command

Method:

Command:

11. getAttribute Command

Method:

Command:

Code snippet:

12. getSize Command

Method:

Command:

Code snippet:

13. getLocation Command

Method:

Command:

Code snippet:






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA