Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iamwarning/simple-whatsapp-automation
Simple script to automate the sending of messages by Whatsapp using Python
https://github.com/iamwarning/simple-whatsapp-automation
automation python3 script scripts selenium selenium-python selenium-webdriver whatsapp whatsapp-bot whatsapp-bot-api whatsapp-web
Last synced: 2 months ago
JSON representation
Simple script to automate the sending of messages by Whatsapp using Python
- Host: GitHub
- URL: https://github.com/iamwarning/simple-whatsapp-automation
- Owner: iamwarning
- License: mit
- Created: 2020-05-09T04:58:08.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-12-06T16:35:29.000Z (about 1 year ago)
- Last Synced: 2023-12-06T17:36:26.243Z (about 1 year ago)
- Topics: automation, python3, script, scripts, selenium, selenium-python, selenium-webdriver, whatsapp, whatsapp-bot, whatsapp-bot-api, whatsapp-web
- Language: Python
- Homepage:
- Size: 61.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Whatsapp Automation
### Installation
To run the script, you must first have [Selenium](https://pypi.org/project/selenium/) installed.
Open the terminal and run the following command:
```bash
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.```python
#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](https://chromedriver.chromium.org/downloads) |
| Mozilla | [Webdriver](https://developer.mozilla.org/en-US/docs/Web/WebDriver) |
| Safari | [Webdriver](https://developer.apple.com/documentation/webkit/testing_with_webdriver_in_safari) |Made the changes, we simply have to execute in the terminal the command:
```bash
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