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

7 Replies, 1691 Views

Hey! Just wanted to chime in—`await page.select puppeteer` should work if the dropdown is a standard `<select>` element. But if it’s not working, it’s likely a timing issue.

Instead of adding a delay, try using `page.waitForFunction` to check if the dropdown is fully populated:
```javascript
await page.waitForFunction(() => {
const dropdown = document.querySelector('select#myDropdown');
return dropdown && dropdown.options.length > 0;
});
await page.select('select#myDropdown', 'optionValue');
```
This is cleaner than a delay and ensures the dropdown is ready. If it’s still not working, maybe the value you’re passing is incorrect?

Messages In This Thread



Users browsing this thread: 1 Guest(s)