feat: handle select tags in getElementInfo
This commit is contained in:
@@ -175,6 +175,13 @@ export const getElementInformation = async (
|
|||||||
info.innerText = targetElement.textContent ?? '';
|
info.innerText = targetElement.textContent ?? '';
|
||||||
} else if (targetElement.tagName === 'IMG') {
|
} else if (targetElement.tagName === 'IMG') {
|
||||||
info.imageUrl = (targetElement as HTMLImageElement).src;
|
info.imageUrl = (targetElement as HTMLImageElement).src;
|
||||||
|
} else if (targetElement?.tagName === 'SELECT') {
|
||||||
|
const selectElement = targetElement as HTMLSelectElement;
|
||||||
|
info.innerText = selectElement.options[selectElement.selectedIndex]?.text ?? '';
|
||||||
|
info.attributes = {
|
||||||
|
...info.attributes,
|
||||||
|
selectedValue: selectElement.value,
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
info.hasOnlyText = targetElement.children.length === 0 &&
|
info.hasOnlyText = targetElement.children.length === 0 &&
|
||||||
(targetElement.textContent !== null &&
|
(targetElement.textContent !== null &&
|
||||||
|
|||||||
Reference in New Issue
Block a user