shauryauppal / PyWhatsapp

Python Automation using selenium & Scheduling of messages and media
https://www.linkedin.com/in/shaurya-uppal
Apache License 2.0
455 stars 159 forks source link

xpath changed for send attachment button #81

Open shauryauppal opened 3 years ago

shauryauppal commented 3 years ago

xpath element changed for attachments button

sachindavra commented 3 years ago

Hi @shauryauppal, I am new to opensource and want to contribute to this. Could you elaborate more on this?

shauryauppal commented 3 years ago

Try out the send attachment feature. You will find the issue.

sachindavra commented 3 years ago

I am experiencing issues while importing PyAutoIt module. Seems it's only for Windows. I am using different OS(Mac).

shauryauppal commented 3 years ago

Oh, if you know any mac alternate to pyautoit you may contribute on that then. It would be a very meaningful contribution used by many devs.

sachindavra commented 3 years ago

Thanks for your reply. As you are already using this library in your code. We can't change it to another library and existing pyautoit library can't be imported in linux/mac.

shauryauppal commented 3 years ago

We run different code snippets based on device os.

https://stackoverflow.com/questions/110362/how-can-i-find-the-current-os-in-python

If macos then run different code. If window run the code which is already there pyautoit.

sachindavra commented 3 years ago

I tried running this on my laptop but unable to do it. I guess AutoIt is a module which you have imported in main script. I am running it by "python PyWhatsapp.py" and "python3 PyWhatsapp.py --chrome_driver_path 'driver/chromedriver'" but of no use. Could you guide me to run the script on mac so that I can test it and change the xpath and raise pull request.

shauryauppal commented 3 years ago

Hey- you need a different chrome driver with based on device. Please go through the readme.md

sachindavra commented 3 years ago

Thanks for guiding. Anyhow, I am able to run the script but when I try to send the message to someone. it prints garbage value and doesn't allow me to enter. Kindly let me know if I am making any mistakes.

(base) sachindavra@Sachins-MacBook-Air PyWhatsapp % python PyWhatsapp.py --help usage: PyWhatsapp.py [-h] [--chrome_driver_path CHROME_DRIVER_PATH] [--message MESSAGE] [--remove_cache REMOVE_CACHE] [--import_contact IMPORT_CONTACT] [--enable_headless ENABLE_HEADLESS]

PyWhatsapp Guide

optional arguments: -h, --help show this help message and exit --chrome_driver_path CHROME_DRIVER_PATH chromedriver executable path (MAC and Windows path would be different) --message MESSAGE Enter the msg you want to send --remove_cache REMOVE_CACHE Remove Cache | Scan QR again or Not --import_contact IMPORT_CONTACT Import contacts.txt or not (True/False) --enable_headless ENABLE_HEADLESS Enable Headless Driver (True/False) (base) sachindavra@Sachins-MacBook-Air PyWhatsapp % python PyWhatsapp.py --message Hi --enable_headless True Web Page Open PLEASE CHOOSE ONE OF THE OPTIONS:

1.Message to Saved Contact number 2.Message to Unsaved Contact number

Enter your choice(1 or 2): 1^M^M

sachindavra commented 3 years ago

To solve the above issue i had to use latest driver for chrome. I had that driver version in cache and used that one. It's working fine. I will see the issue and change xpath accordingly.

sachindavra commented 3 years ago

I tested out the send_attachment feature. It is opening till I see media dialogbox but after that you have used AutoIt in the code which is only for windows and going to the absolute path of the image. If we want to run it on Mac/linux then we might need to change to selenium functionally or something else.

Please suggest.