Whatsapp BOT with nodeJs

whatsapp-bot-with-nodejs

`
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

})();

function delay(time){
return new Promise(function(resolve){
setTimeout(resolve, time)
})
}
`

Total
6
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
dom-element-observer

DOM Element Observer

Next Post
today-i-learned:-the-subtle-art-of-code-reviews-

✨Today I Learned: The Subtle Art of Code Reviews 💡✨

Related Posts