I am working on a project to navigate and scrape a website with selenium, python.
hemnet_path = "https://www.hemnet.se/"
driver = webdriver.Chrome(path, chrome_options=options)
driver.get(hemnet_path)
The script navigates to this site and loops over all the listings to get price, location, hyperlink etc. by loading the result elements like this:
result = driver.find_elements(By.CLASS_NAME,"sold-property-listing")
It then reads pieces of information like:
for r in result:
try:
location = r.find_element(By.CLASS_NAME,"sold-property-listing__location")
except:
location = 'Missing'
The problem that I am having is that the hyperlink-string (screenshot) is not "behaving" like the other elements.
I can't seem to select by class nor by CSS selector and href because I get the following error:
I have successfully used XPATH to get the link like so:

But the problem is that when I iterate over the results the XPATH is always refering to the same ad, 2 in this case. I have considered looping over the integer in the XPATH but that turned out to be very unreliable.
I am not sure what I am missing here and why I am getting this strange error.
Any help on this would be greatly appreciated. HTML for the... element is provided below.
<li class="sold-results__normal-hit">
<a class="hcl-card" data-target-blank="true" href="https://www.hemnet.se/salda/lagenhet-3rum-barkarbystaden-jarfalla-kommun-karlslundsvagen-26-1492088" rel="noopener" target="_blank">
<div class="sold-property-listing">
<div class="sold-property-listing__location">
<h2 class="sold-property-listing__heading">
<span class="property-icon property-icon--result"><svg width="14" height="16" viewBox="0 0 14 16" xmlns="http://www.w3.org/2000/svg"><title>Lägenhet</title><desc><span class="svg-icon__fallback-text">Lägenhet</span></desc><path class="svg-icon__shape" d="M0 1.333v13.334C0 15.403.597 16 1.333 16h4v-5.333H8V16h4c.737 0 1.333-.597 1.333-1.333V1.333C13.333.597 12.737 0 12 0H1.333C.597 0 0 .597 0 1.333" fill="#C1569D" fill-rule="evenodd"></path></svg>
</span>
<span class="item-result-meta-attribute-is-bold item-link qa-selling-price-title">Karlslundsvägen 26</span>
</h2>
<div>
<span class="hide-element">
Lägenhet
</span>
<span class="item-link">
Barkarbystaden,
</span> Järfälla kommun
</div>
</div>
<div class="sold-property-listing__size">
<div class="clear-children">
<div class="sold-property-listing__subheading sold-property-listing--left">
78 m²
3 rum
</div>
<div class="sold-property-listing__fee">
4 233 kr/mån
</div>
</div>
</div>
<div class="sold-property-listing__price">
<div class="clear-children">
<span class="sold-property-listing__subheading sold-property-listing--left">
Slutpris 3 295 000 kr
</span> </div>
<div class="clear-children">
<div class="sold-property-listing__sold-date sold-property-listing--left">
Såld 5 november 2021
</div>
<div class="sold-property-listing__price-per-m2 sold-property-listing--left">
42 244 kr/m²
</div>
</div>
</div>
<div class="sold-property-listing__price-change">
±0 %
</div>
<div class="sold-property-listing__broker">
Länsförsäkringar Fastighetsförmedling Järfälla
</div>
<div class="sold-property-listing__labels">
<div class="hcl-labels-list hcl-labels-list--row-direction">
<span class="hcl-labels-list__label-item">
<span class="hcl-label hcl-label--feature hcl-label--on-white-background">
Uteplats
</span>
</span>
<span class="hcl-labels-list__label-item">
<span class="hcl-label hcl-label--feature hcl-label--on-white-background">
Hiss
</span>
</span>
</div>
</div>
</div>
</a>
</li>


