`
const puppeteer = require(‘puppeteer’);
(async function(){
try{
const browser = await puppeteer.launch({ headless:false })
const page = await browser.newPage()
await page.setUserAgent(
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"
);
await page.goto("https://web.whatsapp.com/")
await page.waitForSelector("._13NKt");
await delay(5000)
const contactName = "Corona Bot";
await page.click(`span[title='${contactName}']`);
await page.waitForSelector('.fd365im1')
const amountOfMessages = 10;
for(var i =0; i<amountOfMessages; i++){
await page.type(".p3_M1", "Hi, how are you, I hope you are good!");
delay(2000)
await page.keyboard.press("Enter");
await delay(500)
}
}catch(err){
console.log(err)
}
})();
function delay(time){
return new Promise(function(resolve){
setTimeout(resolve, time)
})
}
`
Print
Share
Comment
Cite
Upload
Translate
APA
pawan deore | Sciencx (2024-03-28T23:59:26+00:00) » Whatsapp BOT with nodeJs. Retrieved from https://www.scien.cx/2022/11/20/whatsapp-bot-with-nodejs/.
MLA" » Whatsapp BOT with nodeJs." pawan deore | Sciencx - Sunday November 20, 2022, https://www.scien.cx/2022/11/20/whatsapp-bot-with-nodejs/
HARVARDpawan deore | Sciencx Sunday November 20, 2022 » Whatsapp BOT with nodeJs., viewed 2024-03-28T23:59:26+00:00,<https://www.scien.cx/2022/11/20/whatsapp-bot-with-nodejs/>
VANCOUVERpawan deore | Sciencx - » Whatsapp BOT with nodeJs. [Internet]. [Accessed 2024-03-28T23:59:26+00:00]. Available from: https://www.scien.cx/2022/11/20/whatsapp-bot-with-nodejs/
CHICAGO" » Whatsapp BOT with nodeJs." pawan deore | Sciencx - Accessed 2024-03-28T23:59:26+00:00. https://www.scien.cx/2022/11/20/whatsapp-bot-with-nodejs/
IEEE" » Whatsapp BOT with nodeJs." pawan deore | Sciencx [Online]. Available: https://www.scien.cx/2022/11/20/whatsapp-bot-with-nodejs/. [Accessed: 2024-03-28T23:59:26+00:00]
rf:citation » Whatsapp BOT with nodeJs | pawan deore | Sciencx | https://www.scien.cx/2022/11/20/whatsapp-bot-with-nodejs/ | 2024-03-28T23:59:26+00:00
https://github.com/addpipe/simple-recorderjs-demo