I tried accessing the website to get data but the cookie consent pops up. I tried various ways to click "Accept All." The code always runs perfectly but the button is never clicked. I wonder what is wrong with my code.
This is what I tried
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Chrome()
url = "https://www.aplusa-online.com/vis/v1/en/exhprofiles/JP10FQtPTBydU4Ic9MvR7A?oid=19008&lang=2"
driver.get(url)
time.sleep(5)
element = driver.execute_script("""return document.querySelector('usercentrics-roots').shadowRoot.querySelector("button[data-testid='uc-accept-all-button']")""")
element.click()