Unable to click button using selenium for specific site

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC


def main(driver):
    driver.get("https://masscannabiscontrol.com/product-catalog/")
    try:
        element = WebDriverWait(driver, 20).until(
            EC.presence_of_element_located((By.CSS_SELECTOR, "button.btn"))
        ).click()
    finally:
        driver.quit()


if __name__ == "__main__":
    driver = webdriver.Firefox()
    main(driver)

I still keep getting timeout Exception. what could be the reason as am trying to click on I'm 21 Or Older

Answer

def main(driver):
    driver.get("https://masscannabiscontrol.com/product-catalog/")
    WebDriverWait(driver, 20).until(
        EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR, "iframe"))
    )
   
    element = WebDriverWait(driver, 20).until(
         EC.element_to_be_clickable((By.CSS_SELECTOR, "button.btn"))
        )
    driver.execute_script(
        "arguments[0].scrollIntoView({'inline':'center','block':'center'})", element)
    element.click()

if __name__ == "__main__":
    driver = webdriver.Firefox(desired_capabilities=firefox_capabilities)    
    main(driver)

The button is inside an iframe you have to switch to it first.

make sure to switch back to default content to interact again with elements outside of iframe

   driver.switch_to.default_content()