Skip to content

0001 expose element list

Ankon Chakraborty edited this page Sep 11, 2019 · 4 revisions

1. Return a elementList instead of elementWrapper

This ADR has been recorded retrospectively.

Status

Proposed

Context

We decided to add new apis like isDisabled, contentEditable, isCovered etc. There we faced the problem that should taiko check the first matching element or at least one of the matching element. This behaviour is currently inconsistent across apis. And also the elementWrapper.get returns a list of elements. But when elementWrapper.exists() is called we work on the first element of the matching elements only.

Decision

  1. We are going to return an element list from the selector instead of elementWrapper.
  2. The elementList will be a list of elementWrappers which will wrap only one element in each
  3. The elementList will expose same apis as elementWrapper which will route to the first elementWrapper of the list.
  4. Users can loop through the list and write some manual logic.

Examples:

button('foo') will return a list of elementWrappers i.e. [elementWrapper1, elementWrapper2 …]

button('foo')[0] will be a elementWrapper. I.e. {get, value, exists, isDisabled…}

button('foo') will also be a elementWrapper. I.e. {get, value, exists, isDisabled…}. ( This will be similar to button('foo')[0] ).
Clone this wiki locally