-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCF_Disturber.py
More file actions
58 lines (49 loc) · 1.54 KB
/
CF_Disturber.py
File metadata and controls
58 lines (49 loc) · 1.54 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import pyperclip as pc
def setup ( username, password ):
dir = r"C:\Users\HP\Desktop\chromedriver_win32"
chrome_driver_path = dir + "\chromedriver.exe"
# options = webdriver.ChromeOptions ()
# options.add_argument ('headless')
driver = webdriver.Chrome (chrome_driver_path) # options=options)
driver.maximize_window ()
url = "https://codeforces.com/enter"
driver.get (url)
handle = driver.find_element_by_id ("handleOrEmail")
passw = driver.find_element_by_id ("password")
handle.send_keys (username)
passw.send_keys (password)
checkbox=driver.find_element_by_id("remember")
if(checkbox.is_selected()):
pass
else:
checkbox.click()
x = passw.submit ()
driver.implicitly_wait (1000)
time.sleep (2)
return driver
def start ( ):
#Give Your username
Username = ""
#Give password
Password = ""
driver = setup (Username, Password)
#Here give the username of person you want to disturb
want_to_disturb=""
time_interval=60 #in seconds
url = "https://codeforces.com/usertalk?other="+want_to_disturb
message="Hello"
while(True):
driver.get (url)
text_area = driver.find_elements_by_class_name ('wysiwyg')[2]
driver.find_element_by_class_name ('html').click()
pc.copy (message)
text_area.send_keys (Keys.CONTROL+'v')
driver.implicitly_wait (100)
btn = driver.find_elements_by_class_name ("submit")[1]
btn.submit ()
driver.implicitly_wait (1000)
time.sleep (time_interval)
start()