from requests_html import HTML doc = open('dy.html').read() html = HTML(html=doc) links = html.find('div[data-e2e="user-detail"] a', first=True).attrs['href'] print(links)