If you are looking for a tutorial to sharpen your skills on Python Automation by using Selenium and Web drivers you’ve come to the right place, as in this article we are going to discuss how to create a python script that prints your Whatsapp recent contacts using browser automation.
Code can be found here: https://github.com/learningdollars/vivekdw-whatsappcontacts
1. You must be using python 3 to run the code.
2. Your Google Chrome and Chrome Driver versions must be the same. For instance, I have Google Chrome Version 73.0.3683.103 (Official Build) (64-bit), and I downloaded the corresponding Chrome Driver.
3. You can download the specific versions of chrome driver from the link – http://chromedriver.chromium.org/downloads
4. I have configured my Selenium code to leverage Google Chrome driver .
5. You must download selenium. You can use the command – python -m pip3 install selenium to download selenium.
6. You must have downloaded webdriver manager. Use the command – python -m pip3 install webdriver-manager.
Download the chrome driver from the link http://chromedriver.chromium.org/downloads
Remember, your Chromedriver version should match your Google Chrome version. Please check your Google Chrome version using Help->About Google Chrome. After following above process you can see your Chrome Version as shown below.
Next, create a python file with whatever name you like. I called it whatsapp_contacts.py and wrote the following code:
Final Step: After you run this code a new tab will open which will ask you to login on your whatsapp web.
Now after scanning the QR CODE using Whatsapp’s mobile app, check the terminal where you can see your 15 recent contacts are printed.
Github repository for the above is: https://github.com/learningdollars/vivekdw-whatsappcontacts
If you have any questions you can comment on this post and I will get back to you ASAP.