You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Locator object apparently can be resolved to several elements, so can represent a list.
And there are some useful methods to use in this case (e.g. Locator.first()Locator.nth() etc).
Same time, If I need to iterate several locators, the only way I see (please correct me if I'm wrong) is to get the count first, and then take each new item by index from locator list manually:
let itemsCount = await this.pickLkistItem.count() // find the count
for (let index = 0; index < itemsCount; index++) {
let item = this.pickLkistItem.nth(index) //get the element by index within locator list
// . . . do what you need
}
And this looks really overwhelming.
If a locator can be a list, could we use the Iterable functions instead? E.g.:
for (const item of [this.pickLkistItem]) {
item // . . . do what you need
}
I guess that the count of the locator items should be frozen at the point of the iterable function start, so if it increases, additional iterations are ignored. Otherwise, a 'missing element' error should be thrown if the count decreased
Or I'm missing something and this is already supported somehow?
The text was updated successfully, but these errors were encountered:
A Locator object apparently can be resolved to several elements, so can represent a list.
And there are some useful methods to use in this case (e.g.
Locator.first()
Locator.nth()
etc).Same time, If I need to iterate several locators, the only way I see (please correct me if I'm wrong) is to get the count first, and then take each new item by index from locator list manually:
And this looks really overwhelming.
If a locator can be a list, could we use the Iterable functions instead? E.g.:
Or:
I guess that the count of the locator items should be frozen at the point of the iterable function start, so if it increases, additional iterations are ignored. Otherwise, a 'missing element' error should be thrown if the count decreased
Or I'm missing something and this is already supported somehow?
The text was updated successfully, but these errors were encountered: