vasani-arpit / WBOT

A simple Web based BOT for WhatsApp™ in NodeJS 😜. Working as of 📅 Feb 4th, 2024
Other
987 stars 314 forks source link

clicktosend: Send the message instantly. (0.23.0) #271

Closed nikhilmaske-2001 closed 2 years ago

nikhilmaske-2001 commented 2 years ago

(Bumped version: 0.23.0)

BUG: clicktosend feature does not work. Fixes #270

Solution: Replace await page.click("#main footer div.copyable-area div div div button"); with page.keyboard.press("Enter");

Testing plan: Tested with clicktosend true and false value

GIF: clicktosend

nikhilmaske-2001 commented 2 years ago

@vasani-arpit I am trying to handle this case from long time but I am stuck on it, can you please guide me? When the input box contains some text we should only send the smartreply and not with the input box text + smartreply, to solve this issue I am trying to select that input box value and modify it accordingly, but I am not able to select that input box. I have tried few stuffs for this like, const messageBox = await page.$("#main > footer > div._2BU3P.tm2tP.copyable-area > div > div > div._2lMWa > div.p3_M1 > div > div._13NKt.copyable-text.selectable-text") but it does not work.

vasani-arpit commented 2 years ago

@nikhilmaske-2001 have you tried xpath to select element instead of css selector?

nikhilmaske-2001 commented 2 years ago

I have tried this syntax for xpath, is it correct ?

await page.waitForXPath("//#main > footer > div._2BU3P.tm2tP.copyable-area > div > div > div._2lMWa > div.p3_M1 > div > div._13NKt.copyable-text.selectable-text");

let messageBox = await page.$x("//#main > footer > div._2BU3P.tm2tP.copyable-area > div > div > div._2lMWa > div.p3_M1 > div > div._13NKt.copyable-text.selectable-text");
console.log(messageBox);

ref : https://dev.to/sonyarianto/practical-puppeteer-how-to-use-waitforxpath-and-evaluate-xpath-expression-15cp

Ps: this one does not work

nikhilmaske-2001 commented 2 years ago

When the input box contains some text we should only send the smartreply and not with the input box text + smartreply,

@vasani-arpit I think this feature is not that important, we can go with the current change included in this PR, and merge this PR now. I will add this task in my to-do list and work on it anyother time, for now we can open a new issue for this with tag enhancement.

vasani-arpit commented 2 years ago

Okay. No problem. Bump up the version then I will merge this in master.

nikhilmaske-2001 commented 2 years ago

@vasani-arpit I have bumped the version on this PR as well as #269 . Both are ready to merge

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.