3

I want to get the href attributes from the given HTML code so that i can go inside the link and scrape some data from it.

<div class="cb-col cb-col-67 cb-rank-plyr"> <a class="text-hvr-underline text-bold cb-font-16" href="/profiles/1643/aaron-finch" title="Aaron Finch's Profile">Aaron Finch</a> <div class="cb-font-12 text-gray">AUSTRALIA</div> </div>

<div class="cb-col cb-col-67 cb-rank-plyr"> <a class="text-hvr-underline text-bold cb-font-16" href="/profiles/10863/fakhar-zaman" title="Fakhar Zaman's Profile">Fakhar Zaman</a> <div class="cb-font-12 text-gray">PAKISTAN</div> </div>

I want to get the attributes of href and save it to a list.

2 Answers 2

1

You can use regular expressions to parse out thinks in the HTML such as that href tag.

Here is an article explaining that: https://medium.com/@tracy_blog/regex-and-selenium-2c5a89f23a17

Sign up to request clarification or add additional context in comments.

Comments

0

To accomplish this, I would consider using get_attribute(name) over a regular expression.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.