@qualweb/util
Version:
Utilities module for qualweb
19 lines (18 loc) • 527 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
function getVisibleText(element) {
const children = element.getElementChildren();
let text = '';
if (children.length === 0) {
text = element.getElementText();
}
else {
for (const child of children) {
if (window.DomUtils.isElementVisible(child)) {
text += ' ' + getVisibleText(child);
}
}
}
return text ? text.trim() : '';
}
exports.default = getVisibleText;