I would like to use Codecept syntax to grab a list of locators, something like List = driver.findElements(…) in Selenium.
The need for this is to grab the list of products from a cart for example and store them in a list of Product objects or just as a list of strings by their name.
I have found a workaround but it’s not very pretty.
var names = []
let locator = locate("…")
for (i = 1; i <= await I.grabNumberOfVisibleElements(locator); i++) {
names.push(await I.grabTextFrom(locator.at(i)))
}
Is there a possibility to grab all the product containers as Locator array or list and iterate that array?