June 19, 2023
selenium web elements

Introduction: In Selenium, a Web Element is an object that represents an HTML element on a web page. Selenium Web Elements can be located using a variety of locator strategies, such as by ID, name, CSS selector, or XPath. Once a Web Element has been located, it can be manipulated using a variety of commands, such as click(), sendKeys(), and isSelected().

List of Web Elements – Selenium
Types of Web Elements / HTML Elements

We can divide the elements in three ways:
i) Single Elements
We can easily find out a locator for Single Element to work with selenium. We can locate by ID or by name or by linkText

ii) Group Elements
We should try to prefer name as identifier along with a combination of value or index property for Group elements,

iii) Customized Elements
Custom Elements allow web developers to define new types of HTML elements

List of Web Elements

List of Web Elements
i) Edit Box – to enter a value
ii) Link – redirects to another location or page
iii) Button – submits
iv) Image, Image Link, Image Button
v) Text box – To enter text
vi) Text Area – Text Area present in the Application
vii) Checkbox – Select or Unselect an Option
viii) Radio Button- Select any one option
ix) Drop down box – Select an Item
x) List box – Select One or more Items
xi) Combo box – Select an Item or Enter new Item
xii) Web table /HTML table – Displays content in tabeller format
xiii) Frame – Section of a web page(iFrame)
xiv) (Calendars)DatePickers – Pic data/month/year

Browser is not a web element, it is a tool for accessing web pages. A web page is a container for web elements.

Actions on Web/HTML Elements

  1. Actions on Browser
    Launch the browser,
    Navigate to a particular web page,
    Close focused Browser
    Close all Browsers that were opened by WebDriver during execution
    Navigate from one URL to another
    Navigate back to the previous URL
    Navigate forward
    Refresh the Browser
    Maximize the Browser
  1. Actions on Edit box
    Enter a Value,
    Clear the Value,
    Check enabled status,
    Check edit box existence,
    Get the value etc…
  1. Actions on Link
    Click Link,
    Check the link existence,
    Check the link enabled status,
    Return the Link Name
  1. Actions on Button
    Check Enabled status
    Display status

5) Operations Image
Three types of Image elements in Web Environment
a) General Image (No functionality)
b) Image Button (Submits)
c) Image Link (Redirects to another page/location)

6) Operations on Text Area

Return / Capture Text Area or Error message from a web page

7) Operations on Check box
Check if the check box is displayed or not?
Check if the check box is enabled or not?
Check if the check box is Selected or not?
Select the Check box
Unselect the Check box

8) Operations on Radio Button
Select Radio Button
Verify if the Radio Button is Displayed or not?
Verify if the Radio Button is enabled or not?
Verify if the Radio Button is Selected or not?

9) Operations on Drop down box
Check the Drop down box existence
Check if the Drop down is enabled or not?
Select an item
Items Count

10) Operations on Web table /HTML Table
Get cell value
Rows Count
Cells Count etc…

11) Operations on Frame
Switch from Top window to a frame
Switch from a frame to Top window

In conclusion, Selenium Web Elements are a powerful tool for automating web-based applications. By using Web Elements, testers can automate a wide range of user actions, such as clicking on buttons, entering text into fields, and submitting forms.

If you are interested in learning more about Selenium Web Elements, then look no further than QA Training Hub. QA Training Hub offers the best online Selenium training. With a little effort, you can learn how to use Selenium Web Elements to automate your own web-based applications.

Leave a Comment