Skip to content

Commit

Permalink
Use page.select for changing dropdown values
Browse files Browse the repository at this point in the history
  • Loading branch information
amitbadala committed Nov 20, 2023
1 parent 45dd28c commit ab1f839
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ab1f839

Please sign in to comment.