-
Notifications
You must be signed in to change notification settings - Fork 0
/
send_text.py
49 lines (37 loc) · 1.6 KB
/
send_text.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
38
39
40
41
42
43
44
45
46
47
48
49
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import WebDriverException, SessionNotCreatedException
from selenium.webdriver.common.action_chains import ActionChains
import time
import os
import sys
# pyinstaller --onefile --icon=icon.ico send_text.py
print("Để chạy được tool: Phải đảm bảo đã tắt hết trình duyệt Chrome và đã đăng nhập Tinder")
while True:
a = input("Bạn đã chắc chắn (y/n):")
if a.lower() == 'y':
break
exit()
message = input("Nhập lời nhắn:")
driver_path = f"{os.getcwd()}/chromedriver.exe"
user = os.getlogin()
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument(f"--user-data-dir=C:\\Users\\{user}\\AppData\\Local\\Google\\Chrome\\User Data")
driver = webdriver.Chrome(executable_path=driver_path, options=chrome_options)
driver.get("https://tinder.com/")
time.sleep(6)
try:
while True:
time.sleep(2)
match_button = driver.find_element_by_xpath("//button[@id='match-tab']")
ActionChains(driver).move_to_element(match_button).click(match_button).perform()
time.sleep(2)
element = driver.find_element_by_xpath("//div[@class='D(f) Flw(w)']")
result = element.find_elements_by_xpath("//div[@class='P(8px) Ta(c)']")[1]
ActionChains(driver).move_to_element(result).click(result).perform()
time.sleep(2)
text_area = driver.find_element_by_xpath("//textarea[@id='chat-text-area']")
text_area.send_keys(message)
text_area.send_keys(Keys.ENTER)
except:
sys.exit()