Skip to main content

findElement

Finds an element from page using a selector and it's type. The search for the element starts from the root of document. An error is thrown if the element is not found.

findElement(using, by)
# Or
findElement(using, by, noWait)

Parameters#

  • using: string selector used to search element. See details of using.
  • by: by constant. The type of selector. See details of by.
  • noWait: boolean indicating whether to wait for the element to be found on page. See details of noWait.

Returns#

  • Unique elementId that identifies a page element.

Example#

main = findElement('main', by.role)# main is the elementId