How To Automate Facebook Post | Automation Using Python And Selenium | [2020]

Опубликовано: 13 Октябрь 2024
на канале: Coding Cart
10,595
137

This video is about Writing Post On Facebook with help of selenuim in Python.
Download Drivers: https://sites.google.com/a/chromium.o...
#selenium #automation #python
Code Sample:
from selenium import webdriver
from time import sleep
import time
driver=webdriver.Chrome('/Users/satyendra/downloads/chromedriver')
driver.get('https://www.facebook.com')

//*[@id="email"]
//*[@id="pass"]
//*[@id="loginbutton"]
email=driver.find_element_by_xpath('.//*[@id="email"]')
email.send_keys('7278222619')
password=driver.find_element_by_xpath('.//*[@id="pass"]')
#password.send_keys()
with open('pass.txt','r') as myfile:
password1=myfile.read().replace('\n','')
password.send_keys(password1)
login=driver.find_element_by_xpath('.//*[@id="loginbutton"]')
login.click()

sleep(3)
postarea=driver.find_element_by_class_name('_5qtp')
postarea.click()
sleep(3)
activepostarea=driver.switch_to_active_element()
activepostarea.send_keys("Hello Programmer")

postbtn=driver.find_elements_by_tag_name('button')
for btn in postbtn:
print(btn.text)
if btn.text=='Post':
btn.click()

#_1mf7 _4r1q _4jy0 _4jy3 _4jy1 _51sy selected _42ft
button=driver.find_element_by_css_selector('._1mf7._4r1q._4jy0._4jy3._4jy1._51sy.selected._42ft')
button.click()

Follow us on:
Whatsapp:
https://chat.whatsapp.com/LNwHGukUizj...

Facebook:
  / coderscart  

Linkedin:
  / satyendra-jaiswal-903588a2  

Instagram:
  / codingcart