Playwright · Junior · Question 29 of 75
How do you pick an option in a native <select>?
- 1
await locator.choose('blue') - 2
await locator.fill('blue') - 3
await locator.selectOption('blue')
Show the answer
Correct answer: await locator.selectOption('blue')
Explanation
selectOption accepts a value, a label ({ label: 'Blue' }) or several values for a multi-select. Custom dropdowns are tested with clicks instead.