Added Python Script HacktoberFest 2019 (#128)

* Added whatsapp-message Script

* Update README.md
This commit is contained in:
mukeshprasad 2019-11-01 19:00:40 +05:30 committed by Ayush Bhardwaj
parent c04764c6d7
commit ff0ca3a022
4 changed files with 43 additions and 0 deletions

View File

@ -76,6 +76,7 @@ So far, the following projects have been integrated to this repo:
|[PyRecorder](./PyRecorder)|[Rocky Jain](https://github.com/jainrocky)|
|[Pretty CSV](https://github.com/Frizz925/Awesome-Python-Scripts/tree/pretty-csv/Pretty-CSV)|[Frizz925](https://github.com/Frizz925)|
|[File Organizer](https://github.com/Frizz925/Awesome-Python-Scripts/tree/File-Organizer)|[Ayush Bhardwaj](https://github.com/hastagAB)|
|[send_whatsapp_message](https://github.com/mukeshprasad/Awesome-Python-Scripts/tree/master/send_whatsapp_message)|[Mukesh Prasad](https://github.com/mukeshprasad)|
|[YTS Torrents](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/yts_torrents)|[Mayank Nader](https://github.com/makkoncept)|
## How to use :

View File

@ -0,0 +1,21 @@
# Send Whatsapp message!
One can easily send a whatsapp message using this script.
**Pre-requisite:** Scan QR code manually.
## Requirements
- Python3
- Selenium
```console
$ pip install -U selenium
```
- Chromedriver (Needs to be in PATH)
## Instructions
- Install selenium of python module in a recognized location on your desktop.
- Install chromedriver from here. [https://chromedriver.chromium.org/downloads]
**NOTE :** The version of Google Chrome and chromedriver has to be same.

View File

@ -0,0 +1 @@
selenium

View File

@ -0,0 +1,20 @@
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('https://web.whatsapp.com/')
a=1
while a!=0:
input('Scan QR code first and hit enter')
name = input('Enter the name of user or group : ')
msg = input('Enter your message : ')
count = int(input('Enter the count : '))
user = driver.find_element_by_xpath('//span[@title = "{}"]'.format(name))
user.click()
msg_box = driver.find_element_by_class_name('_3u328')
for i in range(count):
msg_box.send_keys(msg)
button = driver.find_element_by_class_name('_3M-N-')
button.click()
a=int(input("Wanna text any other guy?(0/1):"))
if a==0:
print("Bye!\nSee you soon.")