Thursday, December 1, 2016

Whatsapp Hacks!

Prerequisites:


  1. Mozilla Browser
  2. Python 2.7.11
  3. Selenium library in python
  4. Whatsapp 
So, you start by this code in python,

from selenium import webdriver
import time
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.keys import Keys
binary = FirefoxBinary(r'C:\Program Files (x86)\Mozilla Firefox\firefox.exe') #location of firefox.exe
b = webdriver.Firefox(firefox_binary=binary)
b.get('http://web.whatsapp.com')
raw_input()
print("Success!!!")
elem = b.find_element_by_xpath('//span[contains(text(),"Name of group or your friend!")]')
elem.click()
elem1 = b.find_elements_by_class_name('input')
while True:
elem1[1].send_keys('Message That you want to send!')
b.find_element_by_class_name('send-container').click()
or you can find the same code at this link


  • You need to make sure that location of firefox library is correct!
  • Check the name of your friend or group that you want to target
  • you can add whatever message you want to send as a message in send_key(//here).
Once you run this code wait till the firefox is opened with https://web.whatsapp.com

Now scan the QR code generated using, Whatsapp Web option in your Whatsapp(on Phone).

Allow web.whatsapp.com to send notifications, when pop-up is prompted.

You can see that it starts sending message after few seconds.

Enjoy the trick!

Note: 


  1.  Selenium installation on windows
    1.  start command prompt
    2.  C:\Python27\Scripts\pip.exe install -U selenium run this command, you can change the location as per your configuration
    3. from selenium import webdriver
      browser=webdriver.Firefox()
      browser.get('http://www.google.com')                                                           #use this to check whether installation was successful or not
  2. for python you can use any tool and python 2.7 is preferred.


THANK YOU!

Regards,
Saurabh Mardikar