const walk = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT, null, false);
let node = null;
while(node = walk.nextNode()) {
if (node.textContent.search("text to search") >= 0 && node.parentNode) {
node.parentNode.remove();
}
}