Briuor / wbm

wbm is an unofficial API to send bulk messages in whatsapp.
MIT License
205 stars 65 forks source link

Enter button is not working after sending message to first contact #32

Open yashthaker7 opened 2 years ago

yashthaker7 commented 2 years ago

Hi, I'm using version 1.1.16 Node version v11.12.0 Mac os big surr 11.2.1

Message sent successfully in logs but not showing in app. just first contact get the message. I open the browser (showBrowser:true), I see the message initialisation for second contact and onwards but send button in not clicking

I check SEND_BUTTON in node_modules/wbm/src/api.js SEND_BUTTON: 'div:nth-child(2) > button > span[data-icon="send"]'

I also try with delay page.waitFor(5000) but not working

Guyc1800 commented 2 years ago

Hi, I'm using version 1.1.16 Node version v11.12.0 Mac os big surr 11.2.1

Message sent successfully in logs but not showing in app. just first contact get the message. I open the browser (showBrowser:true), I see the message initialisation for second contact and onwards but send button in not clicking

I check SEND_BUTTON in node_modules/wbm/src/api.js SEND_BUTTON: 'div:nth-child(2) > button > span[data-icon="send"]'

I also try with delay page.waitFor(5000) but not working

async function sendTo(phoneOrContact, message) { let phone = phoneOrContact; if (typeof phoneOrContact === "object") { phone = phoneOrContact.phone; message = generateCustomMessage(phoneOrContact, message); } try { process.stdout.write("Sending Message...\r"); await page.goto(https://web.whatsapp.com/send?phone=${phone}&text=${encodeURIComponent(message)}); await page.waitForSelector(SELECTORS.LOADING, { hidden: true, timeout: 60000 }); await page.waitForSelector(SELECTORS.SEND_BUTTON, { timeout: 10000 }); await page.evaluate((SELECTORS)=>{ document.querySelector(SELECTORS.SEND_BUTTON).click() },SELECTORS)
process.stdout.clearLine(); process.stdout.cursorTo(0); process.stdout.write(${phone} Sent\n); counter.success++; } catch (err) { process.stdout.clearLine(); process.stdout.cursorTo(0); process.stdout.write(${phone} Failed\n); counter.fails++; } }

replace with this function