Grab Dynamic HTML Tag from page source

I’m using selenium to create a bot that can automate a task by pulling a report from a website. I’ll preface by saying that I’m not savvy with HTML or Javascript either so forgive me if I use incorrect terminology. Here’s the issue:

I write code in Python to have the bot open the page and then click a button on the page. Beforehand I inspect the page to get the HTML code for the button that needs to be clicked and insert that into my Python code. Say for example this it the HTML:

<div class = "export-data-button-group bar", id = "xyz-123zyx">
<div class = "export-data-button 347-trigger", tabindex = "0", type = "button">
<svg aria-hidden = "true" class = "export-button__icon">

However, once the bot opens the page itself, the code for the button changes. Here’s a visual to explain:

options = webdriver.ChromeOptions()
chrome_driver_binary = r"C:usersuserfolderfolderchrome.exe"
driver = webdriver.Chrome(chrome_driver_binary, options = options)
driver.get(url)
drop_down = driver.find_element(By.CLASS_NAME, "export data button 347")
drop_down.click()

In the 5th line of code, once the bot opens the page, then button label will change from “export data button 347” to something like “random data button 922”.

How can I solve for this?

I’ve researched how to solve for this issue but don’t seem to have any luck on finding answers for grabbing a changing piece of html code.