on-internet
← Community

Is there a way to iterate over a list in Playwright and click over each element?

Stack Overflow ·

I'm trying to iterate over a list of dynamic elements with Playwright, I've tried a couple of things already, but none have been working: await this.page.locator('li').click(); const elements = await this.page.locator('ul > li'); await elements.click() await this.page.$$('ul > li').click(); await this.page.click('ul > li'); const divCounts = await elements.evaluateAll(async (divs) => await divs.click()); this.page.click('ul > li > i.red', { strict: false, clickCount: 1 },) const elements = await this.page.$$('ul > li > i.red') elements.forEach(async value => { console.log(value) await this.pag

Comments

Sign in or sign up to comment and upvote.

No comments yet.