javascriptgetgauge

Gauge Taiko: given selector list/count encountered itens


I'm using Gauge/Taiko to automate some scenarios and I'm struggling with some basic stuff.

Given a selector that match N elements: is there a way to list/count those elements? Today even I provide a selector that matchs N elements, it returns only the 1st match.

example:

$('.input')

returns only the first element with the class input


Solution

  • To just find the number of matching elements (await $('#id').get()).length can be used, to access element by index there is an open issue for the same https://github.com/getgauge/taiko/issues/288

    Update:

    get() is now deprecated in taiko. And taiko supports accessing elements by index. Do use (await $('#id').elements()).length