Highlight an element in selenium , Selenium interview questions

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.

  1. 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:

  1. Text of the title is “QA Tech Tools”
  2. Text of the input is not present
  3. Text of the body is “QaTechTools”
  4. 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.


Description automatically generated with medium confidence

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.