I have the following HTML span:
<button class="coreSpriteHeartOpen oF4XW dCJp8">
<span class="glyphsSpriteHeart__filled__24__red_5 u-__7" aria-label="Unlike"></span>
</button>
I also have a webElement
representing the button containing this span that I have found using xpath
. How can I retrieve the aria-label
value (Unlike) from the element?
I tried to do:
btn = drive.find_element(By.xpath, "xpath")
btn.get_attribute("aria-label")
but it returns nothing. How to retrieve the text value of an element with 'aria-label' attribute from the element object?
btn
in Python? – Carpic"xpath"
looks like a pretty suspicious xpath to me. – Carpic