How to find an element in Selenium?

It is not just an important selenium interview question, but a frequently used function.

A webpage is rendered as elements, sometimes called as HTML tags. There are different identifiers or locators based on which we can select and distinguish an element in web page. These locators or identifiers are:

  • Xpath (Used rarely when you are unable to use other identifiers.)
  • ID (It is commonly used identifier, even while writing CSS or JS code, we use ID to identify an element. )
  • Attribute (We can use various attributes of an HTML tag to identify element.)
  • Linktext (We can choose based on text.)
  • Name (We can select based on name property of element.)
  • CSS (We can select an element based on its CSS properties.)
  • Tag (We can use tag names.)
  • PartialLink Text (We can use partial link tet to select element.)

Top 20 Selenium Interview Questions

Selenium is a web application testing framework. It does not require scripts writing. It is easy to use. Selenium makes… Read More

4 years ago