Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Simple script to automate the sending of messages by Whatsapp using Python

License

Notifications You must be signed in to change notification settings

iamwarning/simple-whatsapp-automation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Whatsapp Automation

Installation

To run the script, you must first have Selenium installed.

Open the terminal and run the following command:

pip install selenium

Plugins

After installing Selenium, a webdriver is required to be able to perform the automation tests in our preferred browser. Once the driver corresponding to the browser that we will use is downloaded, we proceed to save it in the path where our python script is located. Before executing the script, we must first change the target that would be the name of the contact to whom we want to send a message, then we modify the string that is the message we will send.

#Path where the webdriver is located
browser = webdriver.Chrome("/home/baos/Documents/Python/WhatsApp Automation/./chromedriver")

target = '" _user_ "' #Contact name
string = " _message_ " #Custom message  
x_arg = '//span[contains(@title, ' + target + ')]'
target = wait.until(ec.presence_of_element_located((By.XPATH, x_arg)))
target.click()

PD: The script is made to work with Chrome in version 81. The links of the browsers with which automation can be performed are attached.

Browser Driver
Chrome Webdriver
Mozilla Webdriver
Safari Webdriver

Made the changes, we simply have to execute in the terminal the command:

python3 Whatsapp.py 

It will open a browser window and show the WhatsApp page. We scan the qr code with our mobile device to be able to access the messages and we simply observe the magic.

License

MIT