Created
July 17, 2021 06:10
-
-
Save codewithpom/6cb6a10abd40611f88ca3617c82c0715 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium.webdriver import Chrome | |
from selenium.webdriver.chrome.options import Options | |
import time | |
options = Options() | |
options.add_argument("--disable-notifications") | |
options.add_argument("--headless") | |
driver = Chrome(chrome_options=options) | |
driver.get("https://facebook.com") | |
driver.find_element_by_id("email").send_keys('<your email>') | |
driver.find_element_by_id('pass').send_keys("<your password>") | |
driver.find_element_by_xpath('//button[@type="submit"]').click() | |
driver.implicitly_wait(99999999999) | |
driver.find_element_by_xpath('//div[@class="oajrlxb2 b3i9ofy5 qu0x051f esr5mh6w e9989ue4 r7d6kgcz rq0escxv nhd2j8a9 j83agx80 p7hjln8o kvgmc6g5 cxmmr5t8 oygrvhab hcukyx3x cxgpxx05 d1544ag0 sj5x9vvc tw6a2znq i1ao9s8h esuyzwwr f1sip0of lzcic4wl l9j0dhe7 abiwlrkh p8dawk7l bp9cbjyn orhb3f3m czkt41v7 fmqxjp7s emzo65vh btwxx1t3 buofh1pr idiwt2bm jifvfom9 kbf60n1y"]').click() | |
time.sleep(4) | |
print("Clicked") | |
while True: | |
try: | |
driver.find_elements_by_xpath('//div[@class="_1mf _1mj"]')[-1].send_keys("This post has been made a selenium python bot.") | |
driver.find_element_by_xpath('//div[@aria-label="Post"]').click() | |
time.sleep(5) | |
break | |
except Exception: | |
continue | |
driver.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment