Get all text of HTML document From https://stackoverflow.com/questions/17727977/how-to-get-all-text-from-all-tags-in-one-array
function getAllText(startingPoint) {
var text = "";
function gt(start) {
if (start.nodeType === 3)
text += start.nodeValue;
else if (start.nodeType === 1)
if (start.tagName != "SCRIPT" && start.tagName != "STYLE")
for (var i = 0; i < start.childNodes.length; ++i)
gt(start.childNodes[i]);
}
gt(startingPoint);
return text;
}
let allText = getAllText(document.body);