From a448e5624c3e2e51696a562608920ce7b628e538 Mon Sep 17 00:00:00 2001 From: David Hunt Date: Tue, 17 Dec 2024 14:25:32 +1300 Subject: [PATCH] fix: setValue error when inputs have no "type", e.g. select --- packages/playwright/src/PlaywrightWorld.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/playwright/src/PlaywrightWorld.ts b/packages/playwright/src/PlaywrightWorld.ts index f54a87b..0a12d8f 100644 --- a/packages/playwright/src/PlaywrightWorld.ts +++ b/packages/playwright/src/PlaywrightWorld.ts @@ -213,7 +213,7 @@ export class PlaywrightWorld extends QuickPickleWorld { */ async setValue(locator:Locator, value:string|any) { let { tag, type, role } = await locator.evaluate((el) => ({ tag:el.tagName.toLowerCase(), type:el.getAttribute('type')?.toLowerCase(), role:el.getAttribute('role')?.toLowerCase() }), undefined, { timeout: this.worldConfig.stepTimeout }) - if (!tag || !type) throw new Error(`Could not find element with locator: ${locator.toString()}`) + if (!tag) throw new Error(`Could not find element with locator: ${locator.toString()}`) if (tag === 'select') { let values = value.split(/\s*(? v.replace(/\\,/g, ',')) await locator.selectOption(values, { timeout: this.worldConfig.stepTimeout })