Friday, May 7, 2021

How to share to multiple groups using python with selenium - using xpath

#you need to give a good sleep time,otherwise facebook will ban you from selenium import webdriver import traceback from time import sleep from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.by import By from bs4 import BeautifulSoup as bs from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import re #https://www.facebook.com/groups/278269165896178', 'https://www.facebook.com/groups/599666516876521', #'https://www.facebook.com/groups/658045354373001', 'https://www.facebook.com/groups/220935877936879', sites1 =['https://www.facebook.com/groups/540883845992917', 'https://www.facebook.com/groups/501648613217675', 'https://www.facebook.com/groups/126947974637822', 'https://www.facebook.com/groups/252755861779969', 'https://www.facebook.com/groups/260435141147065', 'https://www.facebook.com/groups/416005868846917', 'https://www.facebook.com/groups/882720791856988', 'https://www.facebook.com/groups/669915249871846', 'https://www.facebook.com/groups/539902196376253', 'https://www.facebook.com/groups/220938211265460', 'https://www.facebook.com/groups/218060888249544', 'https://www.facebook.com/groups/210672628994239', 'https://www.facebook.com/groups/1697154313677271', 'https://www.facebook.com/groups/2070201339962983', 'https://www.facebook.com/groups/2340896868', 'https://www.facebook.com/groups/257470767697668', 'https://www.facebook.com/groups/166813026811552', 'https://www.facebook.com/groups/1376863349216327', 'https://www.facebook.com/groups/78503471499', 'https://www.facebook.com/groups/2065331650359895', 'https://www.facebook.com/groups/1037431582973850', 'https://www.facebook.com/groups/479440325399329', 'https://www.facebook.com/groups/120040058098694', 'https://www.facebook.com/groups/1786288918273718', 'https://www.facebook.com/groups/928759187188339', 'https://www.facebook.com/groups/1581735288749271', 'https://www.facebook.com/groups/124325960981600', 'https://www.facebook.com/groups/1094411787306299', 'https://www.facebook.com/groups/223694647682308', 'https://www.facebook.com/groups/838347132842741', 'https://www.facebook.com/groups/689069114522527', 'https://www.facebook.com/groups/1808549316129560', 'https://www.facebook.com/groups/114609428571319', 'https://www.facebook.com/groups/1789638984672878', 'https://www.facebook.com/groups/311415738994937', 'https://www.facebook.com/groups/1854021431561644', 'https://www.facebook.com/groups/168317413190802', 'https://www.facebook.com/groups/2059467967664033', 'https://www.facebook.com/groups/2032587143439984', 'https://www.facebook.com/groups/2012253798994416', 'https://www.facebook.com/groups/1989815967951521', 'https://www.facebook.com/groups/1975445519381526', 'https://www.facebook.com/groups/1925949914401391', 'https://www.facebook.com/groups/1895147997259017', 'https://www.facebook.com/groups/1891299224437704', 'https://www.facebook.com/groups/1869396196677616', 'https://www.facebook.com/groups/1796151083932554', 'https://www.facebook.com/groups/1790418971212597', 'https://www.facebook.com/groups/1770018626373034', 'https://www.facebook.com/groups/1740035142891102', 'https://www.facebook.com/groups/1733956110187200', 'https://www.facebook.com/groups/1716627611894133', 'https://www.facebook.com/groups/1681658218565819', 'https://www.facebook.com/groups/1672694686332142', 'https://www.facebook.com/groups/1668268553264419', 'https://www.facebook.com/groups/1652653411462372', 'https://www.facebook.com/groups/1647937458630243', 'https://www.facebook.com/groups/1631262200459925', 'https://www.facebook.com/groups/1616457151922354', 'https://www.facebook.com/groups/1600210043602852', 'https://www.facebook.com/groups/1586834828244916', 'https://www.facebook.com/groups/1580461938908029', 'https://www.facebook.com/groups/1570589976551608', 'https://www.facebook.com/groups/1566667106884208', 'https://www.facebook.com/groups/1552752741648915', 'https://www.facebook.com/groups/1545489948999332', 'https://www.facebook.com/groups/1537691099777841', 'https://www.facebook.com/groups/1517154311917666', 'https://www.facebook.com/groups/1508486282698936', 'https://www.facebook.com/groups/1508175726085894', 'https://www.facebook.com/groups/1502801413313574', 'https://www.facebook.com/groups/1496529060601953', 'https://www.facebook.com/groups/1494219514126249', 'https://www.facebook.com/groups/1482233185365602', 'https://www.facebook.com/groups/1481801188732013', 'https://www.facebook.com/groups/1471570276498476', 'https://www.facebook.com/groups/1470362069686830', 'https://www.facebook.com/groups/1439537633030684', 'https://www.facebook.com/groups/1436177143266974', 'https://www.facebook.com/groups/1425993427695971', 'https://www.facebook.com/groups/1403997823150081', 'https://www.facebook.com/groups/1389712651350452', 'https://www.facebook.com/groups/1385356911735940', 'https://www.facebook.com/groups/1379931355552983', 'https://www.facebook.com/groups/1299121986794781', 'https://www.facebook.com/groups/1253920617956188', 'https://www.facebook.com/groups/1242105925882181', 'https://www.facebook.com/groups/1215718488444533', 'https://www.facebook.com/groups/1158445397539212', 'https://www.facebook.com/groups/1139733989455401', 'https://www.facebook.com/groups/1071850039655897', '', 'https://www.facebook.com/groups/972397692872904', 'https://www.facebook.com/groups/896844970350468', 'https://www.facebook.com/groups/894640457271610', 'https://www.facebook.com/groups/868334909854951', 'https://www.facebook.com/groups/860901430952358', 'https://www.facebook.com/groups/837863859669132', 'https://www.facebook.com/groups/791366830981941', 'https://www.facebook.com/groups/778507922352397', 'https://www.facebook.com/groups/776002579077311', 'https://www.facebook.com/groups/771351249544890', 'https://www.facebook.com/groups/766445066809443', 'https://www.facebook.com/groups/737852036279510', 'https://www.facebook.com/groups/710321065648996', 'https://www.facebook.com/groups/709757059372846', 'https://www.facebook.com/groups/701983496517050', 'https://www.facebook.com/groups/701647133341338', 'https://www.facebook.com/groups/699391976926241', 'https://www.facebook.com/groups/697019293823137', 'https://www.facebook.com/groups/689061604453849', 'https://www.facebook.com/groups/686052754864177', 'https://www.facebook.com/groups/681699398830820', 'https://www.facebook.com/groups/676970725688293', 'https://www.facebook.com/groups/664407993570414', 'https://www.facebook.com/groups/660234937371805', 'https://www.facebook.com/groups/660080627366565', 'https://www.facebook.com/groups/654987887847761', 'https://www.facebook.com/groups/624130924768068', 'https://www.facebook.com/groups/612470965443459', 'https://www.facebook.com/groups/609973209089228', 'https://www.facebook.com/groups/608624892633140', 'https://www.facebook.com/groups/608111902665009', 'https://www.facebook.com/groups/604790416570442', 'https://www.facebook.com/groups/599568016774302', 'https://www.facebook.com/groups/592264044218722', 'https://www.facebook.com/groups/589522371066740', 'https://www.facebook.com/groups/586400221495560', 'https://www.facebook.com/groups/577853465574313', 'https://www.facebook.com/groups/572038296254120', 'https://www.facebook.com/groups/571731949518602', 'https://www.facebook.com/groups/565518896958011', 'https://www.facebook.com/groups/563218373744748', 'https://www.facebook.com/groups/562666997094337', 'https://www.facebook.com/groups/561185700610272', 'https://www.facebook.com/groups/558876524127815', 'https://www.facebook.com/groups/556391607711206', 'https://www.facebook.com/groups/554232464712202', 'https://www.facebook.com/groups/550202468368602', 'https://www.facebook.com/groups/545722898853087', 'https://www.facebook.com/groups/545696245442263', 'https://www.facebook.com/groups/534612956555125', 'https://www.facebook.com/groups/528285170611857', 'https://www.facebook.com/groups/525183984189580', 'https://www.facebook.com/groups/519235561463989', 'https://www.facebook.com/groups/517818294939234', 'https://www.facebook.com/groups/516423725070666', 'https://www.facebook.com/groups/515948611820094', 'https://www.facebook.com/groups/513029846109120', 'https://www.facebook.com/groups/508683325836322', 'https://www.facebook.com/groups/507184655963251', 'https://www.facebook.com/groups/506466332827848', 'https://www.facebook.com/groups/500558180684853', 'https://www.facebook.com/groups/499815223382114', 'https://www.facebook.com/groups/498533916870350', 'https://www.facebook.com/groups/496679707049822', 'https://www.facebook.com/groups/496058913753008', 'https://www.facebook.com/groups/487630697991742', 'https://www.facebook.com/groups/487476767933299', 'https://www.facebook.com/groups/482586481777108', 'https://www.facebook.com/groups/482432351773958', 'https://www.facebook.com/groups/481932028491981', 'https://www.facebook.com/groups/480928338591559', 'https://www.facebook.com/groups/480835215262191', 'https://www.facebook.com/groups/479412075421520', 'https://www.facebook.com/groups/478236712227971', 'https://www.facebook.com/groups/474985475941943', 'https://www.facebook.com/groups/470294192988696', 'https://www.facebook.com/groups/468559736502151', 'https://www.facebook.com/groups/466578486761433', 'https://www.facebook.com/groups/465973243569088', 'https://www.facebook.com/groups/462855904248747', 'https://www.facebook.com/groups/462392703969948', 'https://www.facebook.com/groups/455633234510644', 'https://www.facebook.com/groups/455009054611714', 'https://www.facebook.com/groups/454538264592127', 'https://www.facebook.com/groups/454382201274578', 'https://www.facebook.com/groups/452581658114149', 'https://www.facebook.com/groups/434189423282295', 'https://www.facebook.com/groups/433629689993309', 'https://www.facebook.com/groups/432443773596619', 'https://www.facebook.com/groups/431021216954531', 'https://www.facebook.com/groups/430419726999085', 'https://www.facebook.com/groups/429778283785806', 'https://www.facebook.com/groups/427365844137526', 'https://www.facebook.com/groups/426138100738706', 'https://www.facebook.com/groups/425446787478171', 'https://www.facebook.com/groups/424799004203503', 'https://www.facebook.com/groups/422859234397155', 'https://www.facebook.com/groups/422670814452671', 'https://www.facebook.com/groups/420533024668977', 'https://www.facebook.com/groups/419169394791884', '', 'https://www.facebook.com/groups/418710504868673', 'https://www.facebook.com/groups/414963952044742', 'https://www.facebook.com/groups/409850719070114', 'https://www.facebook.com/groups/407404042647935', 'https://www.facebook.com/groups/406918266022075', 'https://www.facebook.com/groups/406317166493078', 'https://www.facebook.com/groups/405062009610650', 'https://www.facebook.com/groups/394318290998044', 'https://www.facebook.com/groups/393514164080475', 'https://www.facebook.com/groups/387266638011281', 'https://www.facebook.com/groups/386951324653620', 'https://www.facebook.com/groups/386388294715089', 'https://www.facebook.com/groups/385996318114865', 'https://www.facebook.com/groups/383315938427558', 'https://www.facebook.com/groups/381779558968921', 'https://www.facebook.com/groups/378980375787311', 'https://www.facebook.com/groups/377554149341459', 'https://www.facebook.com/groups/376920092350515', 'https://www.facebook.com/groups/375418986479002', 'https://www.facebook.com/groups/370735516359151', 'https://www.facebook.com/groups/370731269633669', 'https://www.facebook.com/groups/370368766363159', 'https://www.facebook.com/groups/369616689726333', 'https://www.facebook.com/groups/369008149858779', 'https://www.facebook.com/groups/367834069962459', 'https://www.facebook.com/groups/366902410108576', 'https://www.facebook.com/groups/364567516923925', 'https://www.facebook.com/groups/364414363605005', 'https://www.facebook.com/groups/363824340347112', 'https://www.facebook.com/groups/363726453676580', 'https://www.facebook.com/groups/359391744154587', 'https://www.facebook.com/groups/357600121034738', 'https://www.facebook.com/groups/354770471289423', 'https://www.facebook.com/groups/353739811387424', 'https://www.facebook.com/groups/353571134664851', 'https://www.facebook.com/groups/353368538113047', 'https://www.facebook.com/groups/350606105359020', 'https://www.facebook.com/groups/348756255143052', 'https://www.facebook.com/groups/348616648564187', 'https://www.facebook.com/groups/347539082098227', 'https://www.facebook.com/groups/346760108716649', 'https://www.facebook.com/groups/342354895892313', 'https://www.facebook.com/groups/341435492562334', 'https://www.facebook.com/groups/340921639346466', 'https://www.facebook.com/groups/339445862749507', 'https://www.facebook.com/groups/338416886221711', 'https://www.facebook.com/groups/337613449703127', 'https://www.facebook.com/groups/337442299686814', 'https://www.facebook.com/groups/337402446603440', 'https://www.facebook.com/groups/336465659826573', 'https://www.facebook.com/groups/336386416372228', 'https://www.facebook.com/groups/333312623670827', 'https://www.facebook.com/groups/333231240580227', 'https://www.facebook.com/groups/332859313588652', 'https://www.facebook.com/groups/330077273696348', 'https://www.facebook.com/groups/329402050419645', 'https://www.facebook.com/groups/327695117951336', 'https://www.facebook.com/groups/326385240813443', 'https://www.facebook.com/groups/326357814374297', 'https://www.facebook.com/groups/324644324277696', 'https://www.facebook.com/groups/324341400999835', 'https://www.facebook.com/groups/322781948169121', 'https://www.facebook.com/groups/318707554841565', 'https://www.facebook.com/groups/317076864997444', 'https://www.facebook.com/groups/316284328383953', 'https://www.facebook.com/groups/315296111877669', 'https://www.facebook.com/groups/303534636439073', 'https://www.facebook.com/groups/302970463173887', 'https://www.facebook.com/groups/302640016451177', 'https://www.facebook.com/groups/302492079801705', 'https://www.facebook.com/groups/300778973267026', 'https://www.facebook.com/groups/299124640194745', 'https://www.facebook.com/groups/298920120177971', 'https://www.facebook.com/groups/298810163483615', 'https://www.facebook.com/groups/298320946979425', 'https://www.facebook.com/groups/297993443921167', 'https://www.facebook.com/groups/297721530376938', 'https://www.facebook.com/groups/296289557108133', 'https://www.facebook.com/groups/295428597144824', 'https://www.facebook.com/groups/291893270953693', 'https://www.facebook.com/groups/291154230955572', 'https://www.facebook.com/groups/289304794549618', 'https://www.facebook.com/groups/288857441296096', 'https://www.facebook.com/groups/287112594656119'] sites=["https://www.facebook.com/groups/813215445837439/", "https://www.facebook.com/groups/1477663489136837/", "https://www.facebook.com/groups/1094411787306299/", "https://www.facebook.com/groups/191633844725018/", "https://www.facebook.com/groups/salesforcehyd/", "https://www.facebook.com/groups/167528139970828/", "https://www.facebook.com/groups/479617975381544/", "https://www.facebook.com/groups/309645370012078/", "https://www.facebook.com/groups/199321180678412/", "https://www.facebook.com/groups/oraclesiebeleim/", "https://www.facebook.com/groups/computer.science.and.software.engineering/", "https://www.facebook.com/groups/2665006127118033/", "https://www.facebook.com/groups/340148747290497/" ] ###################### try: yy = 0 zz = 0 usr='username@yahoo.com' pwd='password' option = Options() option.add_experimental_option("prefs", { "profile.default_content_setting_values.notifications": 1 }) option.add_argument("window-size=480x854") driver = webdriver.Chrome(chrome_options=option) driver.execute_script("document.body.style.zoom = '0.50'") driver.get('https://www.facebook.com/') #print ("Opened facebook") sleep(5) username_box = driver.find_element_by_id('email') username_box.send_keys(usr) #print ("Email Id entered") sleep(1) password_box = driver.find_element_by_id('pass') password_box.send_keys(pwd) #print ("Password entered") sleep(2) login_box = driver.find_element_by_class_name('_42ft._4jy0._6lth._4jy6._4jy1.selected._51sy') login_box.click() sleep(3) driver.find_element_by_tag_name('body').send_keys(Keys.COMMAND + 't') #driver.get( 'https://www.facebook.com/groups/2662696183998967') sleep(1) #driver.get('https://www.facebook.com/groups/2662696183998967/?ref=group_header') #elem2 = driver.find_element_by_xpath("//span[text()='Write something']") #driver.set_window_size(50, 50) sleep(10) print(sites) for z in sites: try: driver.get(sites[zz]) zz = zz + 1 sleep(10) a = driver.find_element_by_class_name('bp9cbjyn.j83agx80.ihqw7lf3.hv4rvrfc.dati1w0a.pybr56ya') print(a) driver.implicitly_wait(10) ActionChains(driver).move_to_element(a).perform() a.click() ele3 = driver.switch_to.active_element #find this xpath from inspect element ,rght click full xpath b = driver.find_element_by_xpath("/html/body/div[1]/div/div[1]/div/div[4]/div/div/div[1]/div/div[2]/div/div/div/div/div[1]/form/div/div[1]/div/div/div[1]/div[2]/div[1]/div[1]/div[1]/div/div/div/div/div/div/div/div/div") sleep(5) b.send_keys('salesforce service cloud and prepare for webassessor salesforce Discount udemy coupons salesforce SAlesforce Lightning aura components https://www.udemy.com/course/programming-salesforce-lightning-components-dev-601-salesforce/?couponCode=SALESFORCEAURA Discount udemy coupons salesforce LWC https://www.udemy.com/course/salesforce-lightning-web-component-development-essentials/?couponCode=B249399C59C0CD4AE881 Salesforce lightning web components tutorial Discount udemy coupons salesforce SAlesforce Apex programming https://www.udemy.com/course/salesforce-apex-programming-bootcamp/?couponCode=SALESFORCELOGIN Saleforce Apex tutorial- Learn Apex Triggers, BAtch Apex,visual force pages, Controllers custome and standard Discount udemy coupons salesforce SAlesforce Admin 201 https://www.udemy.com/course/salesforce-administrator-201-app-builder-developer/?couponCode=SALESFORCEADMINCERT salesforce Admin Certification') c =driver.find_element_by_xpath("/html/body/div[1]/div/div[1]/div/div[4]/div/div/div[1]/div/div[2]/div/div/div/div/div[1]/form/div/div[1]/div/div/div[1]/div[3]/div[2]/div[1]/div") #ActionChains(driver).move_to_element(c).perform() c.click() sleep(20) #b.send_keys('testing the bot2',Keys.ENTER) #c =driver.find_element_by_xpath("/html/body/div[1]/div/div[1]/div/div[4]/div/div/div[1]/div/div[2]/div/div/div/div/div[1]/form/div/div[1]/div/div/div[1]/div[3]/div[2]/div[1]/div") #ActionChains(driver).move_to_element(c).perform() #c.click( except Exception as exception: print(traceback.format_exc()) continue sleep(3) sleep (2) #print (elem2) print ("Done") #input('Press anything to quit') driver.quit() print("Finished") exit() except Exception as exception: print(traceback.format_exc()) exit() End of code-------------------------- Learn salesforce ,python and react :

Well done on learning this Python programming language, Now also please take a look at some of  salesforce CRM topics ,which is again a high demand technology in 2021.  Salesforce comes with a no coding -using clicks automation platform as well as a coding platform - apex.  Also salesforce has released its new UI lightning components. Wish you all the best in your software career.

Content:

1. Salesforce Lightning  Administrator Certification tutorial

2. Salesforce Apex Programming BootCamp

3. Programming Lightning Components DEV 601 Salesforce

4. Salesforce Lightning Web Component development tutorial

Happy learning and Stay Safe

No comments:

Post a Comment