'Unable to extract hrefs from a tags

I am trying to extract hrefs for two cars(marked in red) from web page. These hrefs are under a tag, to reach them I have tried using CSS_selectors and XPath but with no success. Thank you in advance.

driver.get("https://www.akrapovic.com/en/car/products/Ferrari?brandId=20")
    outer_tag = driver.find_element(By.XPATH,'//*[@id="ak-app"]/div[1]/abstract/products/section/product-listing/div/div/div[3]/div[1]/div[2]')
    print(outer_tag.find_element(By.XPATH,'//a').get_attribute('href')

enter image description here



Solution 1:[1]

unsure as to the specific href element that you would like but this gets the href of the tag for the items you have highlighted

driver.get("https://www.akrapovic.com/en/car/products/Ferrari?brandId=20")
outer_tag = driver.find_elements_by_class_name('item-wrapper')
print(outer_tag[0].get_attribute('href'))

gets

https://www.akrapovic.com/en/car/products/Ferrari/458-Italia-458-Spider?brandId=20&modelId=70

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1