I am building a Chrome Extension. Trying to remove a HTML element which contains certain text. Have found the element using Xpath. But the element doesn't remove, and there is no error message.
<div>
<div>Some Text</div>
</div>
let element = document.evaluate("/*[text() = 'Some Text']", document, null, XPathResult.ANY_TYPE, null)
element.remove();
This runs, but the element is not deleted.