title: Is there a way to get a website element by the visible text?
body: <p>I am just starting to learn some basics of javascript related to html. I would like to know is there a way to select the html element by its visible text?</p>
  <p>For example:
  If I would like to click the “Interesting” button on the stackfoverflow page I can find the element by querySelector.</p>
  <p>stack overflow html page code sample:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;a class=&quot;youarehere is-selected flex--item s-btn s-btn__muted s-btn__outlined&quot; 
      href=&quot;?tab=interesting&quot; 
      data-nav-xhref=&quot;&quot; 
      title=&quot;Questions that may be of interest to you based on your history and tag preference&quot; 
      data-value=&quot;interesting&quot; data-shortcut=&quot;&quot;&gt;
          Interesting
  &lt;/a&gt;
  </code></pre>
  <p>one way of locate the html element:</p>
  <pre class="lang-js prettyprint-override"><code>document.querySelector(&quot;a[class='youarehere is-selected flex--item s-btn s-btn__muted s-btn__outlined']&quot;).click()
  </code></pre>
  <p>I know there might be some other ways to locate the element, but am I able to locate the element by the visable text “Interesting”? Thanks if anyone knows how.</p>
  <p>stack overflow page html sample image down below.</p>
  <p><a href="https://i.stack.imgur.com/F2WWH.png" rel="nofollow noreferrer">stack overflow html sample</a></p>