This script automates the process of adding members to a WhatsApp group using Selenium. It allows you to add participants by their phone numbers.
- Python 3.x
- Selenium
- Google Chrome
- ChromeDriver
Make sure you have Python installed on your machine. You can download it from python.org.
- Check your version of Google Chrome by going to chrome://settings/help
- Download the corresponding version of ChromeDriver from the ChromeDriver download page.
- Extract the downloaded file and move it to a directory in your PATH using the following commands:
sudo mv chromedriver /usr/local/bin/chromedriver
sudo chmod +x /usr/local/bin/chromedriver
You can install Selenium using pip. Open your terminal or command prompt and run:
pip install selenium
- Replace the placeholder your group name with the actual name of your WhatsApp group in the script.
group_name = "your group name"
- Update the phone_numbers list with the phone numbers you want to add. Ensure that the numbers are in the format with country code (e.g., 94718726588).
phone_numbers = [
"94718726588",
# Add more numbers here
]
-
Open a terminal or command prompt in the directory where your script is located.
-
Run the script using Python:
python add_group_members.py
- Scan the QR code to log in to WhatsApp Web when prompted. Once the QR code is scanned and WhatsApp Web is loaded, press Enter to continue.
- Ensure that your ChromeDriver path is correctly set in the script if it’s not in your system’s PATH.
- This script requires the WhatsApp group to be already created and accessible in your WhatsApp account.
- Be mindful of WhatsApp's terms of service and avoid spamming users.
If you encounter issues:
- Ensure your ChromeDriver version matches your installed Google Chrome version.
- Check the XPath selectors if WhatsApp Web layout changes.
- Make sure you have an active internet connection.