Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Packages
- from selenium import webdriver
- from selenium.webdriver.chrome.service import Service
- from webdriver_manager.chrome import ChromeDriverManager
- from selenium.webdriver.common.action_chains import ActionChains
- from selenium.webdriver.common.keys import Keys
- from urllib.parse import quote
- import time
- # Config
- login_time = 60 # Time for login (in seconds)
- new_msg_time = 5 # Time for a new message (in seconds)
- send_msg_time = 5 # Time for sending a message (in seconds)
- country_code = 60 # Set your country code
- # Initialize the WebDriver with default Chrome profile
- driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
- # Encode Message Text
- with open('message.txt', 'r') as msg_file:
- msg = quote(msg_file.read())
- # Open browser with default link
- link = 'https://web.whatsapp.com'
- driver.get(link)
- time.sleep(login_time)
- # Loop Through Numbers List
- with open('numbers.txt', 'r') as file:
- for n in file.readlines():
- num = n.rstrip()
- link = f'https://web.whatsapp.com/send/?phone={country_code}{num}&text={msg}'
- driver.get(link)
- time.sleep(new_msg_time)
- actions = ActionChains(driver)
- actions.send_keys(Keys.ENTER)
- actions.perform()
- time.sleep(send_msg_time)
- # Quit the driver
- driver.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement