I'm trying to get information that is within the anchor tag but not the href
. 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 "Bewertungspunktestand" (German for rating score) without using the href
, because the href
changes from the seller to seller? The rating score in this example would be 32. Since the text "Bewertungspunktestand" 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.
This is the link to this example.
This is the Python code I tried and didn't work out:
try:
trans = driver.find_element_by_xpath("//a[@aria-label='Bewertungspunktestand']")
except:
trans = '0'
And this is the HTML-Code
<span class="mbg-l">
(<a href="http://feedback.ebay.de/ws/eBayISAPI.dll?ViewFeedback&userid=thuanhtran&iid=133585540546&ssPageName=VIP:feedback&ftab=FeedbackAsSeller&rt=nc&_trksid=p2047675.l2560" aria-label="Bewertungspunktestand: 32">32</a>
<span class="vi-mbgds3-bkImg vi-mbgds3-fb10-49" aria-label="Gelber Stern für 10 bis 49 Bewertungspunkte" role="img"></span>)
</span>