UNPKG

app-walk

Version:

An intuitive guided walkthrough library with UI highlighting and voice narration for web apps.

24 lines (23 loc) 871 B
import { wait } from "./utils"; export async function handleAntDropdownSearch(element, input) { const optionSelector = ".fc-select-item-option-content"; if (!element || !input) return; element.click(); // 展开下拉 element.dispatchEvent(new Event("mousedown", { bubbles: true, cancelable: true })); await wait(500); const options = document.querySelectorAll(optionSelector); if (!options.length) { console.error(`No options found using selector "${optionSelector}".`); return; } options.forEach((opt) => { const optionText = opt.innerText.trim().toLowerCase(); if (optionText.includes(input.toLowerCase())) { console.log(`Selecting matching option: ${opt.innerText}`); opt.click(); } }); console.log(`Selected all options matching "${input}".`); }