What is Web Element?
Anything present on the webpage is Web Element. Such as text box, button, link etc. Before performing any action in Selenium we should identify the Web Element using its characteristics given by the application developer with the help of HTML.
What are the components of Web Element?
While developing the Web Element using HTML, developer will specify following components.
- HTML Tag: Any word which is present after the ‘<’ symbol can be a HTML tag.
- Attributes: Any word present after the HTML till the ‘>’ symbol is called as Attributes. Which contain ‘=’ symbol. Left side of the ‘=’ symbol is called as ‘Property Name’. Right side of the ‘=’ symbol is called ‘Property Value’.
Example: Type=”text”, Value=”true”, Multiple= “true”, etc
- Text: Any word which is present after the ‘>’ symbol till the end of the respective HTML tag is called as Text.
For the above code:
- Text of the title is “QA Tech Tools”
- Text of the input is not present
- Text of the body is “QaTechTools”
- Text of the html is “QA Tech Tools”
What are the Locators?
Locators are the html tag, attribute, text and expressions. Which are used to identify the Web Element. Locating an Web Element is essential part in Selenium WebDriver because when you wants to take some action on element, first you need to locate that specific element to perform action. In selenium there are 8 types of Locators.
Frequently used locator to locate the UI element using a unique ID. If unique ID value is not available, they will use CSS selector locator followed by XPath locator.