I have a Puppeteer script that logs into a website and then is looking to click on 7 different "Add Time" buttons within an iFrame. Since the IDs change dynamically, I have it looking for the text of the button.
I have it logging in correctly and able to click sometimes, but it doesn't click all the buttons. It isn't consistent either, the last two buttons may click or the second button.
Here is the code:
let test = await frame.$$('[type="button"]')
test.forEach(async el => {
var text = await (await el.getProperty('textContent')).jsonValue()
if (text == "Add Time") {
await el.click();
}
});