I am using a long await page delay(8000) just to ensure all the data in the dropdown box is loaded. I assume there must be a way to wait until all the data in dropdown box is loaded and then automation goes to the next step after that.
I tried using validation for the selectors but we can't get validation for dynamic data populated from the query also tried using await page.delay(n) but this is not a proper way to do because sometimes running a query could take some time.
page.click(selectors.xxx.nnn)
await delay (1000)
page.keyboard.type('abc')
await delay(8000)
page.keyboard.press('ArrowDown')
page.keyboard.press('ArrowDown')
page.keyboard.press('Enter')
await page.waitFor(selectors.xxx.nnn)
page.click(selectors.xxx.nnn)
await page.waitFor(selectors.xxx.abc)
So using delay can be a solution but is not a proper solution. If there was a way I could make browser automation in puppeteer wait, not for the selectors but the data from the backend. It would be nice to make sure all the expected list on a dropdown is populated and can be selected.