mirror of
https://github.com/jo-inc/camofox-browser.git
synced 2026-10-02 04:14:41 +08:00
13 lines
338 B
JavaScript
13 lines
338 B
JavaScript
/** Select an option by its accessible label, then by its HTML value. */
|
|
export async function selectOption(locator, option) {
|
|
try {
|
|
return await locator.selectOption({ label: option });
|
|
} catch (labelError) {
|
|
try {
|
|
return await locator.selectOption({ value: option });
|
|
} catch {
|
|
throw labelError;
|
|
}
|
|
}
|
|
}
|