Wie akzeptiere ich Facebook-Cookies mit Python Selenium?
Verfasst: Samstag 6. April 2024, 23:14
Ich habe ein Problem beim Klicken auf die Facebook-Schaltfläche „Cookies akzeptieren“.
Ich danke Ihnen für Ihre Hilfe
Ich danke Ihnen für Ihre Hilfe
Code: Alles auswählen
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
import time
service = Service(executable_path="chromedriver.exe")
driver = webdriver.Chrome(service=service)
driver.get("https://www.facebook.com/100071044756969/videos/1180978660013442")
time.sleep(5)
driver.find_elements(By.XPATH, "//button[contains(string(), 'Allow essential and optional cookies')]")[0].click()
driver.quit()