I'm running a Selenium script on a website where, randomly, a small notification pops up that blocks some other elements on the page. I was wondering if there was a way to tell Selenium to always be on the look out for this specific element? Once it spots it, I'd make it so that it closes the notification (by clicking a button that is found on the element). Any help would be greatly appreciated – thank you.
The Full XPATH of the element I'm looking out for:
/html/body/div[4]/div/div/snack-bar-container/div/div/bs-custom-snackbar/div/div
The Full XPATH of the button that I want to click (on the pop-up element):
/div/snack-bar-container/div/div/bs-custom-snackbar/div/button