Hi I am practicing and trying to close out of a pop up that occurs when you go to a site. There is an “x” in the top right corner that I want to click once the site opens. I get the site open but can’t figure out how to identify the “x” button ID to click and close it. I am new to HTML and Python. Using MAC/safari.
HTML code when I inspect the button to close the pop up
current code:
from selenium import webdriver
driver = webdriver.Safari()
driver.get(‘https://littlesleepies.com/collections/vip-early-access?utm_source=facebook&utm_medium=social&utm_campaign=vip_5_16_2024’)
import time
def decline_offer():
decline = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, “//[@id=’closeIconSvg’]”)))
decline.click()
Go easy on me I am a newbie lol.
Kristen Holm is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.