PEI Group Interview Question

Coding challenge : How to select from an select list and print all the elements

Interview Answer

Anonymous

Jun 7, 2024

await page.selectOption('select#dropdownId', 'value2'); const dropdownValues = await page.evaluate(() => { const selectElement = document.querySelector('select#dropdownId'); return Array.from(selectElement.options).map(option => option.value); });