Whats-app using Python!
Have you ever wished to automatically wish your friends on their birthdays, or send a set of messages to your friend ( or any Whatsapp contact! ) automatically at a pre-set time, or send your friends by sending thousands of random text on WhatsApp!
Using Browser Automation you can do all of it and much more!
Using Browser Automation you can do all of it and much more!
First of all, it is necessary to install the following: -
1) Python links for selenium (software automated browser)
bindings Python gives a simple API to record functional / acquisition through selenium WebDriver. By clicking on the selenium API you can access all the WebDriver selenium activities sensibly.
Python API closes my Python API that is best suited to access WebDrivers selenium like Firefox, Chrome, etc. Python 2.7 has now supported, and above 3.5.
For Example:
pip install selenium
This document describes the WebDriver Selenio 2 API. Selenium 1 / API selenium RC is not mentioned here.
2) Chrome webdriver
Read the Driver's Guide here: Chromedriver's website (select your own type)
Humidity is called site since it does not have the back seat
If you are blocked, consult the document: contact library
3) Web browser Chrome (open source for browser Chrome)
That's right! They all are improving.
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
import
time
#
Replace below path with the absolute path
#
to chromedriver in your computer
driver
=
webdriver.Chrome('/home/saket/Downloads/chromedriver')
driver.get("https://web.whatsapp.com/")
wait
=
WebDriverWait(driver, 600)
#
Replace 'Friend's Name' with the name of your friend
#
or the name of a group
target
=
'"Friend\'s Name"'
#
Replace the below string with your own message
string
=
"Message sent using Python!!!"
x_arg
=
'//span[contains(@title,'
+
target +
')]'
group_title
=
wait.until(EC.presence_of_element_located((
By.XPATH,
x_arg)))
group_title.click()
inp_xpath
=
'//div[@class="input"][@dir="auto"][@data-tab="1"]'
input_box
=
wait.until(EC.presence_of_element_located((
By.XPATH,
inp_xpath)))
for
i in
range(100):
input_box.send_keys(string
+
Keys.ENTER)
time.sleep(1)
We can add the rules of the distance
Keep on your phone. WhatsApp selected on the upper reach of WhatsApp (3 points)
Then write a script (make sure you add the full path and chromedriver for the purpose of changing the name of your friends).
Translation QR code appears on the screen and enjoys all the power of the page!
Do not hesitate to change the number. Try it:
1. The composition of the group,
2. Send a message from one of the previously listed or non-official listings
3. Send a full board.
Lower thinking about your experience!
When it comes to Google, this is a delicate era. Do not write it again in your browser so it gives you a powerful idea!
Comments related to:
"Explorer" called "selenium"
The article is part of Saket Modi. If you like GeeksforGeeks and you want to participate, you can also write an article using Contrib. See the article in GeeksforGeeks's house and help the other person.
Please write comments if you see any errors, or want to share more information about the above topics.
To getting expect level training for Python training in your Location – Python training in Chennai | Python training in Bangalore | Python training in Pune | Python training in OMR | Python training in Velachery | Python training in Tambaram | Python training in Annanagar | Python training in Marathahalli | Python training in btm | Python Online Training.
Comments
Post a Comment