title: Finding li element by text inside - Selenium Python
body: <p>I have been trying to find a way to click a specific li element by using the text inside, however, whatever I try seems to not be finding the element. </p>
  
  <p>The HTML is;</p>
  
  <p><code>&lt;ul class="shoes-sizen-mp" id="ul_top_hypers" style="overflow: auto;"&gt;</code></p>
  
  <pre><code>&lt;li id="li_284" onclick="return select_size('284')"&gt;&lt;a class="a_top_hypers"&gt;  3.5  &lt;span style="display: none"&gt;,&lt;/span&gt;&lt;br&gt;   35.5&lt;br&gt;&lt;/a&gt;&lt;/li&gt;
  </code></pre>
  
  <pre><code>&lt;li id="li_285" onclick="return select_size('285')"&gt;&lt;a class="a_top_hypers"&gt;  4  &lt;span style="display: none"&gt;,&lt;/span&gt;&lt;br&gt;   36&lt;br&gt;&lt;/a&gt;&lt;/li&gt;
  </code></pre>
  
  <p>This is part of a list where you can select your size (such as 3.5,4,4.5,5). I want to be able to click the specific one by using the text such as 3.5, for example.</p>
  
  <p><em>Edit</em></p>
  
  <pre><code>driver.find_element_by_xpath(f"//ul[@id='ul_top_hypers' and starts-with(@id, 'li_'][contains(text(),'{user_shoe_size}')]").click()
  sleep(20)
  </code></pre>
  
  <p>Above is one of the many things I have tried to locate the element, but nothing just yet.</p>
  
  <p>Any help would be greatly appreciated. Thanks a lot! </p>