Say you have some HTML markup with the following and want to retrieve the Find Me
text, find
will let us do this.
<div class="container">
<span> </span>
<span></span>
<span></span>
<span> Find Me</span>
<span> </span>
</div>
Array.from(document.querySelectorAll('.container span'))
.find(f => f.textContent.trim() !== '')
.textContent.trim()