WebDriver By class

The WebDriver By class allows you to locate the web elements on the web page. There are several location strategies or techniques that can be used.

Locator strategies

The locating strategy can be either absolute or relative.

In absolute locating strategy, you will identify the web element on the page without the help of other elements. Some of the different supported locator strategies are as follows:

  • ID
  • NAME
  • XPATH
  • LINK_TEXT
  • PARTIAL_LINK_TEXT
  • TAG_NAME
  • CLASS_NAME
  • CSS_SELECTOR

Relative Strategy

In the relative locating strategy, you will identify the web element with the help of other elements.