How do I get the TEXT of a hyperlink with selenium and python?
This is the html in question:
<a ng-href="/example/example2/" href="/example/example2/">NEEDED TEXT</a>
I already have the element of the 'a' tag and I am able to successfuly get the link by doing element.get_attribute("href").
But when I try to do element.text i am not able to get "NEEDED TEXT". What is the reason for this?
element.text
?element.text
. I ended up getting it to work with bothelement.get_attribute('innerHTML')
andelement.get_attribute('text')