title: How to find aria-label element using contains in xpath
body: <p>I'm trying to get information that is within the anchor tag but not the <code>href</code>. I want to extract the rating score from a few sellers on eBay. In the following HTML-Code, you can see where the rating score can be found. Is there a way to get the information about the &quot;Bewertungspunktestand&quot; (German for rating score) without using the <code>href</code>, because the <code>href</code> changes from the seller to seller? The rating score in this example would be 32. Since the text &quot;Bewertungspunktestand&quot; is only in this line, I thought it would be possible to let it search for this text and extract the aria-label with this text in it.</p>
  <p>This is the link to <a href="https://www.ebay.de/itm/Apple-MacBook-Pro-15-Laptop-mit-Touchbar-512GB-MPTT2D-A-Wie-neu/133585540546?nordt=true&amp;nma=true&amp;orig_cvip=true" rel="nofollow noreferrer">this example</a>.</p>
  <p>This is the Python code I tried and didn't work out:</p>
  <pre><code>try: 
      trans = driver.find_element_by_xpath(&quot;//a[@aria-label='Bewertungspunktestand']&quot;)
  except:
      trans = '0'
  </code></pre>
  <p>And this is the HTML-Code</p>
  <pre><code>&lt;span class=&quot;mbg-l&quot;&gt;
      (&lt;a href=&quot;http://feedback.ebay.de/ws/eBayISAPI.dll?ViewFeedback&amp;amp;userid=thuanhtran&amp;amp;iid=133585540546&amp;amp;ssPageName=VIP:feedback&amp;amp;ftab=FeedbackAsSeller&amp;amp;rt=nc&amp;amp;_trksid=p2047675.l2560&quot; aria-label=&quot;Bewertungspunktestand: 32&quot;&gt;32&lt;/a&gt;
      &lt;span class=&quot;vi-mbgds3-bkImg  vi-mbgds3-fb10-49&quot; aria-label=&quot;Gelber Stern für 10 bis 49 Bewertungspunkte&quot; role=&quot;img&quot;&gt;&lt;/span&gt;)
  &lt;/span&gt;
  </code></pre>