Summary of Session 22 - Selenium with Java|Locators(ID,Name,LinkText,PartialLinkText,Class&Tag)|2024 New series
In this session on Selenium with Java, the focus was on understanding Locators, which are essential for identifying and interacting with web elements during automation testing. The speaker emphasized that the two main tasks in automation are locating elements on a webpage and performing actions on them.
Key Points Discussed:
- Definition of Locators:
- Types of Locators:
- Basic Locators:
- ID
- Name
- Link Text
- Partial Link Text
- Class Name
- Tag Name
- Customized Locators:
- XPath
- CSS Selectors (not covered in detail in this session)
- Basic Locators:
- Basic Locators:
- Each basic locator is directly supported by Selenium and can be found in the HTML of the page.
- The speaker provided practical examples of how to use each basic locator:
- ID: Used to locate elements with a unique ID attribute.
- Name: Used for elements with a name attribute.
- Link Text/Partial Link Text: Specifically for anchor tags (links) on the page.
- Class Name/Tag Name: Used to locate groups of elements (e.g., multiple buttons or links).
- Practical Demonstrations:
- Find Element vs. Find Elements:
- Find Element: Returns a single web element; throws an exception if no element is found.
- Find Elements: Returns a list of web elements; returns an empty list if no elements are found, without throwing an exception.
- Assignment:
- Viewers were encouraged to practice by locating the total number of links and images on a demo webpage and performing actions using the learned Locators.
Main Speakers/Sources:
- The session was led by an instructor (name not specified), who provided explanations, code examples, and practical demonstrations on the usage of Locators in Selenium with Java.
Notable Quotes
— 00:00 — « No notable quotes »
Category
Technology