Merge pull request #322 from getmaxun/inputs-select
feat: handle selection for input & select tags
This commit is contained in:
@@ -175,7 +175,17 @@ export const getElementInformation = async (
|
||||
info.innerText = targetElement.textContent ?? '';
|
||||
} else if (targetElement.tagName === 'IMG') {
|
||||
info.imageUrl = (targetElement as HTMLImageElement).src;
|
||||
} else {
|
||||
} 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 if (targetElement?.tagName === 'INPUT' && (targetElement as HTMLInputElement).type === 'time' || (targetElement as HTMLInputElement).type === 'date') {
|
||||
info.innerText = (targetElement as HTMLInputElement).value;
|
||||
}
|
||||
else {
|
||||
info.hasOnlyText = targetElement.children.length === 0 &&
|
||||
(targetElement.textContent !== null &&
|
||||
targetElement.textContent.trim().length > 0);
|
||||
|
||||
Reference in New Issue
Block a user