The element function is used for finding HTML elements on your webpage. It returns an ElementFinder object, which can be used to interact with the element or get information from it. Element takes one parameter, a Locator, which describes how to find the element.

The by object creates Locators. Here, we’re using three types of Locators

  1. by.model('first') to find the element with ng-model="first". If you inspect the Calculator page source, you will see this is <input type="text" ng-model="first">.
  2. by.id('gobutton') to find the element with the given id. This finds <button id="gobutton">.
  3. by.binding('latest') to find the element bound to the variable latest. This finds the span containing ``