Using pywhatkit to send messages on Whatsapp - automation

This is a well known bug with 'solutions' all over the internet:
When creating a pywhatkit auto-chat on Whatsapp -->
Tab opens
Message populates
The 'send' button is greyed out (I know this is a common bug)
I know this is a common bug and everyone is trying to get around this with something like the below (pyautogui, pynput, etc) but it's simply not working for me.
My dog has gone missing and I need to build a WA chatbot asap, can anyone help?
Ex.
pyautogui.click()
time.sleep(2)
keyboard.press(Key.enter)
keyboard.release(Key.enter)```
time.sleep(5)
pyautogui.click()
time.sleep(2)
keyboard.press(Key.enter)
keyboard.release(Key.enter)
Expected the pynput to work.

Related

How to add sign in to {x} with Google elegant pop-up on top-right corner

Sites like https://streeteasy.com/ and https://www.geeksforgeeks.org/ incorporate the same UI that allows you to log-in using Google Auth with one click. The photo below shows an example.
Since many sites have this identical UI, I assume there is some Google/Firebase mode, but I do not see documentation related to this.
Perhaps this link in the html provides some help in figuring this out? ux_mode=popup I am familiar with, but ui_mode=card I am not. https://accounts.google.com/gsi/iframe/select?client_id=388036620207-3uolk1hv6ta7p3r9l6s3bobifh086qe1.apps.googleusercontent.com&ux_mode=popup&ui_mode=card&as=al2HYo2TiehJpHITNY8fJQ&channel_id=9384f02a26b236ce29c0acab5000e8c656b9bbfb3202c094cd65f92e2468d6a3&origin=https%3A%2F%2Fwww.geeksforgeeks.org
This UI use "One tap sign-in and sign-up" of Google. Is very easy, the URL with complete integration and implementation is:
https://developers.google.com/identity/one-tap/web/guides/get-google-api-clientid
I found the solution in
Documentation for the automatic "Continue as" Google popup

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

I have to use whatsapp's click to chat feature for automating the process of sending messages to unsaved numbers. I am currently using selenium to automate the process. I am able to send text messages only for now. I was wondering that it might be possible to send other media files as well like images and videos.
There are 2 unused parameters in my url of click to chat feature, "source" and "data". I thought using these might enable me to send media files but I Haven't been able to do it yet.
Example URL for one of my click to chat messages:
https://web.whatsapp.com/send?phone=phoneNumHere&text=Hi&source=&data=
Can anyone confirm that either its possible or not. If its possible what would be the right way to do it?
Thanks
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 add
driver.findElement(By.cssSelector("span[data-icon='clip']")).click();
//add file path
driver.findElement(By.cssSelector("input[type='file']")).sendKeys("FilePath");
//click to send
driver.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 contacts
Sending 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.
Coding Working Fine.
//To send attachments
//click to add
driver.findElement(By.cssSelector("span[data-icon='clip']")).click();
//add file to send by file path
driver.findElement(By.cssSelector("input[type='file']")).sendKeys("FilePath");
//click to send
driver.findElement(By.cssSelector("span[data-icon='send-light']")).click();
I was having the same issue but right after fixing it, I made a python wrapper so that it helps more people having the same issue.
In case you're interested to explore more about the wrapper, here is a link
https://github.com/Kalebu/alright
Here is how to send a message to media files and message to unsaved contacts
>>> from alright import WhatsApp
>>> messenger = WhatsApp()
>>> messenger.find_user('255-74848xxxx')
>>> messenger.send_message("I wish you a Merry X-mass and Happy new year ")
>>> messenger.send_picture('path-to-image',"Text to accompany image")
Sending to Multiple unsaved contacts
>>> numbers = ['2557xxxxxx', '2557xxxxxx', '....']
>>> for number in numbers:
messenger.find_user(number)
messenger.send_message("I wish you a Merry X-mass and Happy new year "

XPages: Login not working?

im having a huge problem with the login node in the Web Browser. I click "Login" on the top right corner of my layout. It gets me to the login screen. All fine so far. Then im trying to login and as soon as i typed in my login-data and press "Sign in" Its just reloading the login-page. It doesnt take me back to the site i came from, it doesnt log me in, nothing. Im only having this issue in the web browser since it automatically logs you in, in the Notes Client. Thanks in advance.
PS: Sorry for the bad english.
Sincerly,
Brugen
Agree with Paul...
You could try: http://yourserver.com/names.nsf?open&login to check if your login is correct - disregarding any issues with your XPage.
Next, have a look at your server console to see if anything is written there to indicate a problem. If so it is easiest to use something like the XPages Log Reader to investigate the log files on the server. From the link there is a link to the project where you can download the database.
HTH :-)
/John
Sorry if this is assuming too little knowledge, but are you trying the correct username and password? By default Notes Client and web passwords are not synchronised, it's a separate HTTPPassword field in your Person document on the server. After changing, it may take a few minutes to take effect.

Mechanical Turk - can't view HIT, appears blank

I m trying to setup a few image categorization tasks on Mechanical Turk sandbox developer version. When I try to view the HIT(the annotation image), it appears blank. I clicked on the 'Accept HIT' button but I still couldn't see anything.
In order to make sure that nothing was wrong with my project setup in particular, I signed in as a worker to accept HITS on other projects involving image categorization. I still continue to see a blank image in their categorization projects, where the image to be annotated is supposed to be displayed.
Can anyone help with this problem?Thanks.
Problem solved - it was a simple browser incompatibility problem.
I know you have already answered this for yourself, however for other requesters out there I think this may be useful.
I was developing HITs and I too was having issues view the HIT in Sandbox in Chrome and Firefox, I realized that it had something to do with the script being blocked by the browser and the way to fix this was to "unblock the content" - usually a shield icon in the URL bar.
When further developing my HIT I added information about how to see the HIT in the description box of the HIT so turkers could read the instructions and then work on the HIT - to be absolutely clear to the turkers, I added a "(READ DESCRIPTION)" in the title so turkers would know where to look.
Hope this helps!

Safari 6's New Developer Toolbar doesn't show Form Data in XHR/AJAX Requests

Safari recently went to version 6 (Lion/Mtn Lion) and they've changed over from the standard webkit dev tools to one that's much more XCode looking, my problem other than the OCD of not liking things change is that in the resource tab (or anywhere you can track down the DataService.aspx/AJAX calls) I can no longer see the form data that I am passing.
Can anyone point me to where I can find that data so I don't have to console out my params when I'm testing new data service/backend calls?
I've logged a bug with Apple, they've marked it as a duplicate so hopefully they've received enough requests to fix this, until then I'm continuing to use chrome as the webkit developer is the same as safari's old version.
You can find this info in Instrument tab (stop-watch icon). In the left sidebar thers Timelines row, click the grey circle (record button) on the right. Then click to Network Requests where you see all reqs, and you have to click small icon on the right oc request to display response headers and all form data are available in right panel. Panel can be hidden same as left one (in case you dnt see it).
Unfortunately there are no query pamaters listed, according to this disscussion. I belive its a bug in safari
Edit 15.May 2013: This bug was fixed in Safari 6.0.3.
As far as I can tell, there's no way to show the request parameters.
This goes even further. I can't see the JSON response data either (no clickable arrows to show the containing Javascript objects within the JSON, just pure text)
I think we have to switch to Firefox /w Firebug or regular Webkit in order to get XHR monitoring...
Guys if you want to see post data in safari 6 which is not possible right now, install the firebug lite extension and there you go you have the post data.
I used it and it works great with safari 6
Actually the request headers, response headers and query parameters are in the details sidebar on the right when using the resources view or if you click to see the content of a request in the Timelines/Network Requests view. Took me a few minutes to find that too.
If you need to see what the device is actually sending and your server is on a Windows Machine I use http://www.Wireshark.org and check on the server side of things. No interpretation by any WebKit stuff and very valuable (such as issue with iOS and the 'Blob' data). Similar network snooping should exist on Mac as well.