After multiple unsuccessful attempts to try and grab details from the website (https://www.chemist.co.uk/) I realized that there is an iframe that appears after a few seconds and that the event only happens once, when the website is opened. However, I find it difficult to handle the iframe, I tried various methods like finding the iframe based on index and id as well, as the iframe has no name. From my observation this only happens once I open the website. Can someone help me figure out what am I doing wrong?
import os
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
currentdir = os.getcwd()
chrome_options = Options()
# chrome_options.add_argument('--headless')
chrome_options.add_argument("--disable-notifications")
chrome_options.add_argument('--no-sandbox')
driver = webdriver.Chrome(executable_path=f"{currentdir}/chromedriver.exe", options=chrome_options)
# driver.maximize_window()
driver.implicitly_wait(20)
driver.get("https://www.chemist.co.uk/")
time.sleep(5)
# driver.switch_to.frame(1)
iframe = driver.find_element_by_id("AWIN_CDT")
driver.switch_to.frame(iframe)
driver.find_element_by_xpath("//a[@data-trigger='dismiss.close']").click()
driver.switch_to.default_content()
