How to send media files on whatsapp programmatically using click to chat feature? How to send media files on whatsapp programmatically using click to chat feature? selenium selenium

How to send media files on whatsapp programmatically using click to chat feature?


Similar question: Whatsapp Automated Bot not able to search in WhatsApp Contact List

Send images, videos and docs using Selenium:

//To send attachments//click to adddriver.findElement(By.cssSelector("span[data-icon='clip']")).click();//add file pathdriver.findElement(By.cssSelector("input[type='file']")).sendKeys("FilePath");//click to senddriver.findElement(By.cssSelector("span[data-icon='send-light']")).click();


I know it's too late, I just have to add that Whatsapp Web and Whatsapp Desktop accept paste inputs, thus if you can get your picture to the memory (I did it with VB.net took 5 mins to accomplish after a bit of googling) you can just send a paste order and it'll load it in and require and ENTER send key from you.


Part1: Sending messages to unsaved contactsSending media to unsaved numbers is quite a difficult task but not impossible. You can surely find XPath by text.

Part2: Yes media can be sent to contacts. I have done that in my project link : https://github.com/shauryauppal/PyWhatsapp. By using PyAutoIt you can send Pictures, PDF, Videos to the selected contacts.

Since uploading part is not the automation of web browser we auto windows using AutoIt and select the path of image/video/file to send to the user.

autoit.control_focus("Open","Edit1")autoit.control_set_text("Open","Edit1",(PATH_OF_IMAGE_TO_SEND) )autoit.control_click("Open","Button1")

This is just the crux of the implementation. Do refer my repo in case of more understanding.

PS: Don't forget to star repo or give credits.

Check answer Link for more info, where to download AutoIt from.