项目作者: iamwarning

项目描述 :
Simple script to automate the sending of messages by Whatsapp using Python
高级语言: Python
项目地址: git://github.com/iamwarning/whatsapp-automation.git
创建时间: 2020-05-09T04:58:08Z
项目社区:https://github.com/iamwarning/whatsapp-automation

开源协议:MIT License

下载


Whatsapp Automation

Installation

To run the script, you must first have Selenium installed.

Open the terminal and run the following command:

  1. 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.

  1. #Path where the webdriver is located
  2. browser = webdriver.Chrome("/home/baos/Documents/Python/WhatsApp Automation/./chromedriver")
  3. target = '" _user_ "' #Contact name
  4. string = " _message_ " #Custom message
  5. x_arg = '//span[contains(@title, ' + target + ')]'
  6. target = wait.until(ec.presence_of_element_located((By.XPATH, x_arg)))
  7. 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
Mozilla Webdriver
Safari Webdriver

Made the changes, we simply have to execute in the terminal the command:

  1. 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