title: How to click an element that contains visible text and is clickable with Selenium with Python
body: <p>The element to be clicked based ONLY on the text it contains (others):</p>
  <pre><code>&lt;a class=&quot;blah&quot; href=&quot;/some_page/&quot;&gt;&lt;span&gt;15&lt;/span&gt; others&lt;/a&gt;
  </code></pre>
  <p>The item that fails:</p>
  <pre><code>driver.find_element(By.XPATH, &quot;//*[contains(text(), ' others')]&quot;).click()
  </code></pre>
  <p>The error:</p>
  <pre><code>NoSuchElementException: no such element: Unable to locate element: {&quot;method&quot;:&quot;xpath&quot;,&quot;selector&quot;:&quot;//*[contains(text(), 'others')]&quot;}
  </code></pre>