I found a general example you can consult at :
https://debuglab.net/2023/07/04/handling-accept-cookies-popup-with-selenium-in-python/
and also an older post over here:
Handling "Accept Cookies" popup with Selenium in Python
I'm no a pro but based on what you shared you should take a look at the overlay modal part of this article:
https://www.lambdatest.com/blog/webdriverio-tutorial-handling-alerts-overlay-in-selenium/
Hope it helps