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


Possibly Related Threads…
Thread Author Replies Views Last Post
Music Python Script Repeating Number When Saving Facebook Photos ThuanyPK 2 1,049 May-13-2024, 10:59 PM
Last Post: ebn852_pan
  501 Server cannot accept argument anna17 0 941 Apr-11-2024, 01:08 AM
Last Post: anna17
  Issues Scraping Facebook using facebook_scraper DustinKlent 4 5,187 Mar-19-2024, 08:17 PM
Last Post: Mostafa_heikal
  accept command line argument mg24 5 2,362 Sep-27-2022, 05:58 PM
Last Post: snippsat
  DELETE Post using Python FaceBook Graph API BIG_PESH 0 2,354 Mar-24-2022, 08:28 PM
Last Post: BIG_PESH
  Delete multiple comments with a single API call (facebook) Ascalon 0 3,195 Dec-04-2021, 08:33 PM
Last Post: Ascalon
  How to add an image to an existing facebook post using python graph API? Ascalon 0 2,925 Dec-01-2020, 08:33 PM
Last Post: Ascalon
  Retrieving Cookies whois1230 2 2,982 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 3,350 May-10-2020, 05:57 PM
Last Post: Oethen
  Cookies Donald 3 3,734 Apr-15-2020, 07:06 AM
Last Post: DPaul

Forum Jump:

User Panel Messages

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