If you want to send Whatsapp messages to multiple users at a time, using browser automation with Python Selenium and Web Driver, you are at the right place. This script works after Whatsapp’s most recent updates. So let’s get started with the code.

Open the github repository. Download or clone these three files in the same folder. You can name this folder whatever you want. The rest of the file names should not be changed.

Points to note before you run the script:

1- You must be using python3 to run the code.

2- Your Google Chrome and Chrome Driver versions must be the same. I have Google Chrome of Version 73.0.3683.103 (Official Build) (64-bit) so I downloaded Chrome Driver accordingly.

3- You can download another version of chrome driver from the link – http://chromedriver.chromium.org/downloads please keep reading for more details on this.

4- I built this code to have selenium leverage the Google Chrome driver, specifically.

5- You must have downloaded Selenium as well. You can use the command – pip3 install selenium to download selenium

6- You must have downloaded the web driver manager. You can use the command – pip3 install webdriver-manager to download this.

7- As we are using an Excel file here (named tt.xlxs), you must download openpyxl . Use command – pip3 install openpyxl to download this.

8- In the tt.xlsx file, you have to mention the names that are saved in your contact list in the proper format.

And now you are good to go.

How to execute –

The file named tt.xlsx is an excel file where you have to edit the name of your contacts. After saving these contacts, execute whatsapp_sendmessage.py using python3. To execute, run command python3 whatsapp_sendmessage.py and hit enter.

whatsapp_sendmessage.py

A terminal will open which will ask you to enter the message that you want to send. After that, you will be asked to scan the QR code (to login on Whatsapp Web). Scan the QR code and watch Whatsapp web.

You can see that the message is sent automatically to your contacts with a delay of 5 seconds and after the task is completed, the tab is closed automatically.

I hope this post helped you. If you are still facing any issues you can comment on the post. I will be more than happy to help you. To read more such posts on Automation, here is another post I wrote recently.