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
If you choose audio, it asks what do you want in audio. You give it a text and it converts it into audio automatically.

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)))

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')))

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)))

Step 2: Clicks on attachment icon
user = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CSS_SELECTOR, "[title^='Attach']"))

Step 3: Clicks on media icon
button=WebDriverWait(driver, 8).until(EC.element_to_be_clickable((By.CLASS_NAME, '_1azEi')))

Step 4: Clicks on send icon
button=WebDriverWait(driver, 12).until(EC.element_to_be_clickable((By.CLASS_NAME, '_3nfoJ')))
