forked from SR-Hossain/fb2tele-selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfb.py
38 lines (28 loc) · 734 Bytes
/
fb.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from setup_selenium import goto, driver, xpath
import time
time_slept = 0
def check_for_sust():
global time_slept
while True:
try:
driver.find_element("partial link text", "SUST CSE").click()
return
except:
time.sleep(10)
time_slept += 10
if time_slept >= 3600:
return
def notification():
goto('fb.com/notifications')
def click_on_unread():
while True:
try:
xpath("//span[text()='Unread']").click()
return check_for_sust()
except:
time.sleep(1)
def wait_in_unread_for_new_posts():
global time_slept
time_slept = 0
notification()
click_on_unread()