'Trying to use Selenium and Python and get the link from a button

I'm trying to use Selenium and Python to get all the links from specific buttons that are on the page.

But the button has no a href attribute to return.

Here's the code I've tried. Is there any way I can get these links even though the button doesn't have the attribute?

# Web page url request
driver.get('https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=BR&q=myshopify&sort_data[direction]=desc&sort_data[mode]=relevancy_monthly_grouped&search_type=keyword_unordered&media_type=all')
driver.maximize_window()
time.sleep(10)

ad_info = driver.find_elements_by_xpath('//*[@id="content"]/div/div/div/div[5]/div[1]/div/div/div[3]/div[2]/div[1]/div[1]/div/div[2]/div/span/div/div')
links = []
for i in ad_info:
            links.append(i.get_attribute('href'))

I'm posting a snapshot of the buttons I'm trying to get the links from.

Snapshot highlighting the buttons



Sources

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

Source: Stack Overflow

Solution Source