Lupa API Reference / commands / selectOption
Function: selectOption()
selectOption(
payload):Promise<void>
Defined in: src/commands/index.ts:192
Selects an option in a <select> element by value or label
Parameters
payload
The option to select.
Returns
Promise<void>
A promise that resolves when the option is selected.
Example
it('natively selects an option by value', async () => {
const valueToSelect = 'first'
const select = document.querySelector('#testSelect')
await selectOption({ selector: '#testSelect', value: valueToSelect })
expect(select.value).to.equal(valueToSelect)
})