-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
42 lines (32 loc) · 1.36 KB
/
Copy pathmain.py
File metadata and controls
42 lines (32 loc) · 1.36 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
import time
import random
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
service = Service("..\\whatsapp-pfp-automation\\chromedriver-win64\\chromedriver.exe")
driver = webdriver.Chrome(service=service)
# Open WhatsApp web
driver.get('https://web.whatsapp.com')
# Login WhatsApp web
while True:
verify = input("Did you login? (yes/no): ")
if verify.lower() == "yes":
break
# Entering profile section
profile_section = driver.find_element(By.XPATH,'//*[@id="app"]/div/div[3]/div/header/div/div[2]/div/div[2]/button/div/div/div/div/img')
profile_section.click()
def changing_pfp():
pfp = random.randint(1, 48)
profile_photo = driver.find_element(By.XPATH,'//*[@id="app"]/div/div[3]/div/div[2]/div[1]/span/div/div/span/div/div/div[1]/div/input')
profile_photo.send_keys(f"..\\whatsapp-pfp-automation\\images\\{pfp}.jpg")
time.sleep(1)
zoom_out_pfp = driver.find_element(By.XPATH, '//*[@id="app"]/div/span[2]/div/div/div/div/div/div/div/div/div[1]/div[1]/button[2]/span')
for _ in range(5):
zoom_out_pfp.click()
time.sleep(0.5)
confirm_pfp = driver.find_element(By.XPATH,'//*[@id="app"]/div/span[2]/div/div/div/div/div/div/div/div/div[2]/span/div/div')
confirm_pfp.click()
# Main loop
while True:
changing_pfp()
time.sleep(86400)