Uncategorized

Selenium Python – How To Click Accept Cookies Consent on a Website

#how to accept cookie consent with selenium python
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service

#set location of our chrome driver
s = Service('/usr/local/bin/chromedriver')

chromeOptions = Options()
chromeOptions.headless = False

driver = webdriver.Chrome(service=s, options=chromeOptions)

driver.get("https://corbah.com")

consent_button = driver.find_element(by=By.CLASS_NAME, value="appify_rcc_button")
time.sleep(3)
consent_button.click()