fix select2 multi-select (#656)
This commit is contained in:
@@ -648,16 +648,12 @@ async function getSelect2OptionElements(element) {
|
|||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
oldOptionCount = optionList.length;
|
oldOptionCount = optionList.length;
|
||||||
let newOptionList = document.querySelectorAll(
|
let newOptionList = document.querySelectorAll("[id='select2-drop'] ul li");
|
||||||
"[id='select2-drop'] li[role='option']",
|
|
||||||
);
|
|
||||||
if (newOptionList.length === oldOptionCount) {
|
if (newOptionList.length === oldOptionCount) {
|
||||||
console.log("no more options loaded, wait 5s to query again");
|
console.log("no more options loaded, wait 5s to query again");
|
||||||
// sometimes need more time to load the options, so sleep 10s and try again
|
// sometimes need more time to load the options, so sleep 10s and try again
|
||||||
await sleep(5000); // wait 5s
|
await sleep(5000); // wait 5s
|
||||||
newOptionList = document.querySelectorAll(
|
newOptionList = document.querySelectorAll("[id='select2-drop'] ul li");
|
||||||
"[id='select2-drop'] li[role='option']",
|
|
||||||
);
|
|
||||||
console.log(newOptionList.length, " options found, after 5s");
|
console.log(newOptionList.length, " options found, after 5s");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ class Select2Dropdown(AbstractSelectDropdown):
|
|||||||
self, index: int, timeout: float = SettingsManager.get_settings().BROWSER_ACTION_TIMEOUT_MS
|
self, index: int, timeout: float = SettingsManager.get_settings().BROWSER_ACTION_TIMEOUT_MS
|
||||||
) -> None:
|
) -> None:
|
||||||
anchor = await self.__find_anchor(timeout=timeout)
|
anchor = await self.__find_anchor(timeout=timeout)
|
||||||
options = anchor.locator("li[role='option']")
|
options = anchor.locator("ul").locator("li")
|
||||||
await options.nth(index).click(timeout=timeout)
|
await options.nth(index).click(timeout=timeout)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user