enhance checkbox detecting (#1840)

Co-authored-by: LawyZheng <lawyzheng1106@gmail.com>
This commit is contained in:
Shuchang Zheng
2025-02-26 02:47:09 -08:00
committed by GitHub
parent ae9380f03f
commit 9b9c84f7dc
2 changed files with 20 additions and 0 deletions

View File

@@ -799,6 +799,21 @@ function isDatePickerSelector(element) {
return false;
}
function isCheckableDiv(element) {
const tagName = element.tagName.toLowerCase();
if (tagName !== "div") {
return false;
}
if (
element.className &&
element.className.toString().includes("checkbox") &&
element.childElementCount === 0
) {
return true;
}
return false;
}
const isComboboxDropdown = (element) => {
if (element.tagName.toLowerCase() !== "input") {
return false;
@@ -1300,6 +1315,7 @@ async function buildElementObject(
isAngularDropdown(element) ||
isSelect2Dropdown(element) ||
isSelect2MultiChoice(element),
isCheckable: isCheckableDiv(element),
};
let isInShadowRoot = element.getRootNode() instanceof ShadowRoot;