From ab1f839a966b518ae921cfb9b8d6000543bb5a98 Mon Sep 17 00:00:00 2001 From: amitbadala Date: Mon, 20 Nov 2023 15:45:02 +0530 Subject: [PATCH] Use page.select for changing dropdown values --- test/helpers.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/test/helpers.js b/test/helpers.js index 78a93b800..b24ff29ed 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -418,14 +418,8 @@ export async function setInputValues(page, fields) { } export async function setSelectDropdownValue(page, selector, optionValue) { - return await page.evaluate( - ({ selector, ST_ROOT_SELECTOR, optionValue }) => { - const select = document.querySelector(ST_ROOT_SELECTOR).shadowRoot.querySelector(selector); - select.value = optionValue; - select.dispatchEvent(new Event("change", { bubbles: true })); - }, - { selector, ST_ROOT_SELECTOR, optionValue } - ); + const dropdownEle = await waitForSTElement(page, selector); + return dropdownEle.select(selector, optionValue); } export async function clearBrowserCookiesWithoutAffectingConsole(page, console) {