Python Forum
How to accept facebook cookies using python selenium?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to accept facebook cookies using python selenium?
#1
I have a problem clicking the facebook accept cookies button.
Thank you for your help

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()
Larz60+ write Apr-07-2024, 12:38 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Tags have been added for you this time. Please use BBCode tags on future posts.
Reply


Messages In This Thread
How to accept facebook cookies using python selenium? - by pablo86ad - Apr-06-2024, 09:19 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Music Python Script Repeating Number When Saving Facebook Photos ThuanyPK 2 219 May-13-2024, 10:59 PM
Last Post: ebn852_pan
  501 Server cannot accept argument anna17 0 310 Apr-11-2024, 01:08 AM
Last Post: anna17
  Issues Scraping Facebook using facebook_scraper DustinKlent 4 3,818 Mar-19-2024, 08:17 PM
Last Post: Mostafa_heikal
  accept command line argument mg24 5 1,424 Sep-27-2022, 05:58 PM
Last Post: snippsat
  DELETE Post using Python FaceBook Graph API BIG_PESH 0 1,534 Mar-24-2022, 08:28 PM
Last Post: BIG_PESH
  How to add an image to an existing facebook post using python graph API? Ascalon 0 2,293 Dec-01-2020, 08:33 PM
Last Post: Ascalon
  Retrieving Cookies whois1230 2 2,257 Nov-21-2020, 12:01 PM
Last Post: snippsat
  I need my compiled Python Mac app to accept a file as a parameter Oethen 2 2,498 May-10-2020, 05:57 PM
Last Post: Oethen
  Cookies Donald 3 2,919 Apr-15-2020, 07:06 AM
Last Post: DPaul
  What is the correct type hint when you want to accept Iterable but not Dictionary LadySvetlana 4 3,470 Mar-05-2019, 07:33 PM
Last Post: LadySvetlana

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020