Having trouble with `await page.select` in Puppeteer? Need help with dropdown selection!

7 Replies, 2023 Views

Yo! Dynamically loaded dropdowns can be a pain. I’d suggest waiting for the options to populate before using `await page.select puppeteer`.

Try something like this:
```javascript
await page.waitForSelector('select#myDropdown option[value="optionValue"]');
await page.select('select#myDropdown', 'optionValue');
```
This ensures the option is actually there before you try to select it. If it’s still not working, maybe the dropdown is using some custom JS? In that case, you might need to trigger events manually.

Messages In This Thread



Users browsing this thread: 1 Guest(s)