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

7 Replies, 1698 Views

Hey! I’ve had this exact problem before. `await page.select puppeteer` can be a bit unpredictable with dynamic content. One thing that worked for me was using `page.waitForResponse` to wait for the network request that loads the dropdown options.

Here’s an example:
```javascript
await Promise.all([
page.waitForResponse(response => response.url().includes('dropdown-data-endpoint')),
page.select('select#myDropdown', 'optionValue')
]);
```
This ensures the data is loaded before you try to select the option. If you’re not sure about the endpoint, you can check the network tab in DevTools. Hope this helps!

Messages In This Thread



Users browsing this thread: 1 Guest(s)