Here's how you can automatically send status updates on WhatsApp using python and selenium.
You can use this script to directly upload status from the command prompt, you can tweak this script to automatically send updates on festivals, birthday greetings,etc.
Requirements:
Now you are all set to use this code
This script uses selenium that opens a browser and selects the input field where you need to enter login and password then simulates a click on login button.(id = email , id = pass)
As soon as the person is logged in then it searches for the input field which has content for uploading status.(name = xhpc_message)
When the input field is found it adds the text and simulates press of the enter key.
PS:
You can use this script to directly upload status from the command prompt, you can tweak this script to automatically send updates on festivals, birthday greetings,etc.
Requirements:
- First, install python 3
- We also need to install selenium
- Firefox browser
pip install selenium
Now you are all set to use this code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Use this for educational purpose only, I will not be responsible for any action taken by an individual or facebook against you | |
#Use this script at your own risk. You will be responsible if facebook blocks you. | |
from selenium import webdriver | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.webdriver.common.keys import Keys | |
from selenium.webdriver.common.by import By | |
from selenium.common.exceptions import TimeoutException | |
import time | |
driver=webdriver.Firefox() | |
driver.get("https://www.facebook.com") | |
wait = WebDriverWait(driver, 600) | |
email=driver.find_element_by_id('email') | |
email.send_keys('Your email goes here') | |
print("Email Entered") | |
pwd=driver.find_element_by_id('pass') | |
pwd.send_keys('Your password goes here') | |
print("Password entered") | |
button=driver.find_element_by_id("loginbutton") | |
button.click() | |
print("Login Successfull") | |
search=driver.find_element_by_name("xhpc_message") | |
#change this message to the status that you want to upload | |
search.send_keys("This post is uploaded by a python script :) Enjoy coding") | |
search.submit() |
This script uses selenium that opens a browser and selects the input field where you need to enter login and password then simulates a click on login button.(id = email , id = pass)
As soon as the person is logged in then it searches for the input field which has content for uploading status.(name = xhpc_message)
When the input field is found it adds the text and simulates press of the enter key.
PS:
- To find name and id of input field you can use developer tools of the browser
- You can also use other browsers but will need drivers for them. You can read selenium documentation for the same.
- Use this script for educational purpose only, You will be responsible for any action if taken by facebook or any other individual.
Comments
Post a Comment