Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from selenium import webdriver
- from selenium.webdriver.common.by import By
- from selenium.webdriver.support.ui import WebDriverWait
- from selenium.webdriver.support import expected_conditions as EC
- from selenium.webdriver.common.keys import Keys
- from selenium.webdriver.support.ui import Select
- from selenium.webdriver.common.action_chains import ActionChains
- import random
- import time
- loginnow = False;
- chrome_options = webdriver.ChromeOptions()
- chrome_options.add_argument("--mute-audio")
- driver = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe", chrome_options=chrome_options);
- driver.get("https://www.facebook.com/");
- user = raw_input("Write your E-mail to login :");
- if(user):
- password = raw_input("Write your password to login :");
- if(password):
- loginnow = True;
- elif(password != null):
- driver.quit()
- elif(user != null):
- driver.quit()
- def login():
- emailid = driver.find_element_by_id('email');
- emailid.send_keys(user);
- time.sleep(2)
- passid = driver.find_element_by_id('pass');
- passid.send_keys(password);
- time.sleep(2);
- loginbutton = driver.find_element_by_id("loginbutton");
- driver.execute_script("arguments[0].scrollIntoView();", loginbutton)
- time.sleep(2)
- driver.execute_script("arguments[0].click();", loginbutton)
- print "Logged in"
- def friendaccept():
- friendrequestpage = driver.find_element_by_class_name("jewelButton")
- driver.execute_script("arguments[0].scrollIntoView();", friendrequestpage)
- driver.execute_script("arguments[0].click();", friendrequestpage)
- time.sleep(2)
- seemorefriend = driver.find_element_by_class_name("seeMore")
- driver.execute_script("arguments[0].scrollIntoView();", seemorefriend)
- driver.execute_script("arguments[0].click();", seemorefriend)
- time.sleep(2)
- friendquestcount = 1
- friendquantity = raw_input("How many friend requests do you wish to accept?");
- while(int(friendquantity) != friendquestcount):
- acceptfriend = driver.find_element_by_xpath("//button[" + str(friendquestcount) + "][text()='Bevestigen']") #change this "Bevestigen" word to the english word Accept or accept
- driver.execute_script("arguments[0].click();", acceptfriend)
- friendquestcount += 1
- if(friendquantity == friendquestcount):
- print "Done"
- def groupjoin():
- groupniche = raw_input("What is your niche? :")
- if(groupniche):
- time.sleep(2)
- groupsearch = driver.find_element_by_class_name("inputtext");
- driver.execute_script("arguments[0].scrollIntoView();", groupsearch)
- time.sleep(2)
- groupsearch.send_keys(groupniche)
- time.sleep(2)
- seemoregroup = driver.find_element_by_class_name("seeMoreV2")
- driver.execute_script("arguments[0].scrollIntoView();", seemoregroup)
- driver.execute_script("arguments[0].click();", seemoregroup)
- time.sleep(2)
- finderhier = 0;
- try:
- seemorev1group = driver.find_element_by_xpath("//a[text()='Meer weergeven']") #change this to See more
- driver.execute_script("arguments[0].scrollIntoView();", seemorev1group)
- driver.execute_script("arguments[0].click();", seemorev1group)
- time.sleep(2)
- howmanygroups = raw_input("how many groups do you wish to join ? MAX 20 else you'll get blocked on FB");
- groephoeveel = 0
- while(groephoeveel != howmanygroups):
- try:
- time.sleep(2)
- joingroupnow = driver.find_element_by_xpath("//a[text()='Lid worden']") #change this to Join group in english
- time.sleep(2)
- driver.execute_script("window.scroll(0,400)")
- driver.execute_script("arguments[0].scrollIntoView();", joingroupnow)
- joingroupnow.click()
- groephoeveel += 1
- if(groephoeveel == howmanygroups):
- print "done"
- break
- except:
- print "No groups has been found ! try to choose a different niche!"
- driver.execute_script("window.scroll(0,50)")
- pass
- except:
- driver.switch_to_default_content()
- time.sleep(2)
- driver.execute_script("window.scroll(0,400)")
- time.sleep(3)
- seemorev1group = driver.find_element_by_xpath("//a[text()='Meer weergeven']") #change this to See more
- driver.execute_script("arguments[0].scrollIntoView();", seemorev1group)
- driver.execute_script("arguments[0].click();", seemorev1group)
- time.sleep(3)
- groeps = driver.find_element_by_xpath("//div[text()='Groepen'") #change this to groups
- driver.execute_script("arguments[0].scrollIntoView();", groeps)
- driver.execute_script("arguments[0].click();", groeps)
- time.sleep(2)
- driver.execute_script("window.scroll(0,50")
- pass;
- if(groephoeveel == howmanygroups):
- print "Done"
- else:
- print "not working"
- def commands():
- commandq = raw_input("For group function type !grp for accepting friendrequests type !frq")
- if(commandq == "!frq" or commandq == "!FRQ"):
- friendaccept()
- elif(commandq == "!grp" or commandq == "!GRP"):
- groupjoin()
- if(loginnow):
- login()
- questionnow = raw_input("Write !c for commands.");
- if(questionnow == "!c" or questionnow == "!C"):
- commands()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement