Using Selenium I am trying to read the content of an href link contained in "a" tag, which is "View Upvoter" button on Quora (give you upvoters username list) , i am using this python code in selenium but the result i get is always is empty, any suggestions? Here is the python code:
inputElement = browser.find_element_by_class_name("VoterListModalLink")
inputElement.send_keys("\n") #send enter for links, bttons
print(inputElement.text)
Here is the quora button html :
<a class="AnswerVoterListModalLink VoterListModalLink"
href="/api /mobile_expanded_voter_list?key=zDDQQihxghH&type=answer"
id="__w2_iXtwcOw_modal_link" target="_blank">View Upvoters
</ a>
link to site :https://www.quora.com/Can-you-cash-out-bitcoins
There are 5 View Upvoters link in the link which you have shared with us.
For retrieving href attribute from DOM, you can first store 5 web elements in a list , then use a for each loop to extract the required attribute.
code :
UPDATE 1:
Console output :
Hope that helps