I'm writing a python code that scrapes info from a site, but I have to get rid of some cookies pop-ups first. To click the right buttons, I need their XPaths (as far as I know). The problem is that a part of the XPath changes every time, and I don't know how to find them as they don't really have any attributes like an ID or something.
This is the HTML of the button:
<button class="Button__StyledButton-a1qza5-0 lcqSKB" style="visibility: visible; background-color: rgb(12, 44, 91);">Lees meer om voorkeuren te accepteren</button>
This is the command I'm using right now:
driver.find_element_by_xpath('/html/body/div[14]/div[1]/div[3]/button').click()
And this is the XPath:
/html/body/div[VARIABLE]/div[1]/div[3]/button
where VARIABLE changes every time, so I changed the 14.