A. Sending a text

June 11, 2023 ยท View on GitHub

This script allows you to send audio or text messages to your whatsapp contacts with or without scheduling.

Watch the overview video here. Watch from 2:00 to 6:00 minute.

There are two options. Whether you want to send audio or text Screenshot If you choose audio, it asks what do you want in audio. You give it a text and it converts it into audio automatically.

Screenshot

A. Sending a text

Step 1: Selects the person you want to send the message to

xpath='//span[@title="{}"]'.format(name)
user=WebDriverWait(driver, 200).until(EC.presence_of_element_located((By.XPATH,xpath)))

Screenshot

Step 2: Type a message

msg_box.send_keys(msg)

Step 3: Clicks on send icon

button=WebDriverWait(driver, 5).until(EC.element_to_be_clickable((By.CLASS_NAME, '_35EW6')))

Screenshot

B. Sending an audio message:

Step 1: Selects the person you want to send the message to

xpath='//span[@title="{}"]'.format(name)
user=WebDriverWait(driver, 200).until(EC.presence_of_element_located((By.XPATH,xpath)))

Screenshot

Step 2: Clicks on attachment icon

user = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CSS_SELECTOR, "[title^='Attach']"))

Screenshot

Step 3: Clicks on media icon

button=WebDriverWait(driver, 8).until(EC.element_to_be_clickable((By.CLASS_NAME, '_1azEi')))

Screenshot

Step 4: Clicks on send icon

button=WebDriverWait(driver, 12).until(EC.element_to_be_clickable((By.CLASS_NAME, '_3nfoJ')))

Screenshot