Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a91c14e

Browse files
committed
Update
1 parent e962f5a commit a91c14e

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

‎Automate Facebook bot/script.py

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88

99

1010
LOGIN_URL = 'https://www.facebook.com/login.php'
11-
num = str (input ("Enter comma separated integers: "))
11+
num = str (input ("Enter group ids separated by commas: "))
1212
lists = num.split (",")
1313
groupid = []
1414
for i in lists:
1515
groupid.append(i)
1616

17+
1718
message=input("Enter your message: ")
1819

1920
class FacebookLogin():
@@ -27,25 +28,7 @@ def __init__(self, email, password, browser='Chrome'):
2728
self.driver.get(LOGIN_URL)
2829
time.sleep(1) # Wait for some time to load
2930

30-
for i in range(len(groupid)):
31-
link = 'https://facebook.com/groups/'+groupid[i]
32-
self.driver.get(link)
33-
print("Waiting for few seconds .......")
34-
time.sleep(45)
35-
pyautogui.hotkey('ctrl','f')
36-
pyautogui.typewrite("Create a public post")
37-
pyautogui.press('enter')
38-
pyautogui.press('escape')
39-
pyautogui.press('enter')
40-
time.sleep(2)
41-
pyautogui.typewrite(message)
42-
pyautogui.click(677,520)
43-
44-
time.sleep(10)
45-
46-
47-
48-
31+
4932
def login(self):
5033
email_element = self.driver.find_element_by_id('email')
5134
email_element.send_keys(self.email) # Give keyboard input
@@ -57,7 +40,21 @@ def login(self):
5740
login_button.click() # Send mouse click
5841

5942
time.sleep(2) # Wait for 2 seconds for the page to show up
60-
43+
44+
for i in range(len(groupid)):
45+
link = 'https://facebook.com/groups/'+groupid[i]
46+
self.driver.get(link)
47+
print("Waiting for few seconds .......")
48+
time.sleep(45)
49+
self.driver.find_element_by_class_name('a8c37x1j ni8dbmo4 stjgntxs l9j0dhe7').click()
50+
time.sleep(7)
51+
52+
self.driver.switch_to.active_element.send_keys("message")
53+
time.sleep(7)
54+
55+
self.driver.find_element_by_class_name('a8c37x1j ni8dbmo4 stjgntxs l9j0dhe7 ltmttdrg g0qnabr5').click()
56+
time.sleep(7)
57+
6158

6259
if __name__ == '__main__':
6360
# Enter your login credentials here
@@ -68,3 +65,4 @@ def login(self):
6865

6966
#time.sleep(5)
7067

68+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /