-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTwitter_complaint_bot.py
63 lines (47 loc) · 2.43 KB
/
Twitter_complaint_bot.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import time
chrome_driver_path = "C:\development\chromedriver.exe"
class InternetSpeedTwitterBot:
def __init__(self):
self.driver = webdriver.Chrome(executable_path=chrome_driver_path)
self.up = ""
self.down = ""
def get_internet_speed(self):
self.X_PATH = '//*[@id="container"]/div/div[3]/div/div/div/div[2]/div[3]/div[1]/a'
self.driver.get("https://www.speedtest.net/")
self.go = self.driver.find_element(By.XPATH, self.X_PATH)
self.go.click()
time.sleep(50)
self.download = self.driver.find_element(By.XPATH, '//*[@id="container"]/div/div[3]/div/div/div/div[2]/div[3]/div[3]/div/div[3]/div/div/div[2]/div[1]/div[1]/div/div[2]/span')
self.down = self.download.text
print(self.down)
self.upload = self.driver.find_element(By.XPATH, '//*[@id="container"]/div/div[3]/div/div/div/div[2]/div[3]/div[3]/div/div[3]/div/div/div[2]/div[1]/div[2]/div/div[2]/span')
self.up = self.upload.text
print(self.up)
def tweet_at_provider(self):
self.MAIL = "gggg2002@gmail.com"
self.driver.get(url='https://twitter.com/i/flow/login')
time.sleep(15)
self.id = self.driver.find_element(By.NAME, 'text')
self.id.send_keys(self.MAIL)
self.id.send_keys(Keys.ENTER)
time.sleep(10)
self.password = self.driver.find_element(By.NAME, 'password')
self.password.send_keys("pass")
self.password.send_keys(Keys.ENTER)
time.sleep(10)
self.tweet = self.driver.find_element(By.XPATH, '//*[@id="react-root"]/div/div/div[2]/header/div/div/div/div[1]/div[3]/a')
self.tweet.click()
time.sleep(10)
self.content = self.driver.find_element(By.CSS_SELECTOR, '.DraftEditor-root div div div div div span')
self.content.send_keys(f"Hello @JioCare my speed is {self.down}Mb/s even my 5G is activated. ")
time.sleep(10)
self.sent = self.driver.find_element(By.XPATH, '//*[@id="layers"]/div[2]/div/div/div/div/div/div[2]/div[2]/div/div/div/div[3]/div[2]/div[1]/div/div/div/div[2]/div[2]/div/div/div[2]/div[4]')
self.sent.click()
complain = InternetSpeedTwitterBot()
complain.get_internet_speed()
time.sleep(5)
complain.tweet_at_provider()
'''ComplainetBot'''