Closed Kristian-Tan closed 2 months ago
Hi! You can restart the container by using /stop
(no logout) and /start
the container again for such case.
We could add a shortcut like /restart
for the case, but it'll do basically the same thing.
Restarting the session (calling stop, with or with logout, then start) did not 'update' the whatsapp web. Here's a screenshot of a new session that I newly started:
That's not the only one, I have tried restarting without logout, restarting with logout, manually deleting the mounted volume. All attempt still results in 'click to update whatsapp' button still there
My current solution is to create a new file in /app (enter the docker container first with docker exec -it (containername)
then running this javascript file:
const puppeteer = require('puppeteer');
// https://pptr.dev/api/puppeteer.connectoptions
// https://pptr.dev/api/puppeteer.browser
// https://pptr.dev/api/puppeteer.page
(async () => {
console.log("webSocketDebuggerUrl: "+process.argv[2]);
const browser = await puppeteer.connect({ // https://medium.com/@jaredpotter1/connecting-puppeteer-to-existing-chrome-window-8a10828149e0
// browserWSEndpoint: "ws://127.0.0.1:45873/devtools/browser/30e22e75-56d4-48c1-ad44-84bfa3009a79",
browserWSEndpoint: process.argv[2],
});
console.log("connected");
const pages = await browser.pages(); // https://pptr.dev/api/puppeteer.browser.pages
console.log("number of pages inside browser: "+pages.length);
for (var i = 0; i < pages.length; i++) {
var page = pages[i];
const title = await page.title(); // https://pptr.dev/api/puppeteer.page.title
console.log("page="+i+", title="+title);
// https://stackoverflow.com/questions/45871187/retrieving-javascript-rendered-html-with-puppeteer
// const content = await page.content(); // https://pptr.dev/api/puppeteer.page.content
// console.log(content);
// https://stackoverflow.com/questions/47407791/how-do-you-click-on-an-element-with-text-in-puppeteer
const [button] = await page.$x("//button[contains(., 'Click to update WhatsApp')]"); // https://pptr.dev/api/puppeteer.page._x
if(button) {
console.log("button to update WhatsApp found, clicking...");
await button.click();
console.log("clicked");
}
}
console.log("done");
// exit();
throw new Error('This is not an error. This is just to abort javascript');
})().then(console.log).catch(console.error);
WhatsApp can update their internal API inside such updates, we decided to always PIN the certain version in the project, so you don't get accidental updates with errors
Lately I got problem that I cannot send nor receive messages. The message sent is only showing square waiting clock icon, while received message is showing "waiting for this message ..." instead.
The problem seems to be that the version of whatsapp web running in the browser is out of date. And whatsapp FAQ recommends clicking "click to update whatsapp" link/button. https://faq.whatsapp.com/3398056720476987
I don't know if this will fix the problem or not, but it might be helpful to add an endpoint to click "click to update whatsapp" link/button.