Open qgustavor opened 1 month ago
Hi, I don't have that much time to fix problems in the application, but if it's a viable solution, try making a change to the library and let me know what you've done!
For the outdated message, just instantiate your browser before starting the app in electron:
const chromiumVersion = process.versions.chrome; app.userAgentFallback = "AppTest/0.0.1 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${chromiumVersion} Safari/537.36";
If this works, please give me feedback.
Since the third edit it's been working for me.
Is there an existing issue for this?
Describe the bug
I checked the last released version, 1.25.0, and the way it's failing is completely unexpected: an undefined variable.
Expected behavior
In this line of the code it is trying to get the
puppeteer
variable which was never defined in this file.Steps to Reproduce the Bug or Issue
Just run any example code.
Relevant Code
No response
Browser Type
Other (please write in Additional Context)
WhatsApp Account Type
Standard
Does your WhatsApp account have multidevice enabled?
Yes, I am using Multi Device
Environment
Windows and Android. wwebjs-electron 1.25.0. Electron 31.3.1.
Additional context
I can guess you took whatsapp-web.js issue template, but some questions are not quite relevant here because, unlike the original project, all people running this code should be using Electron, not any other browser, likewise it should ask for the Electron version, as IIRC Electron doesn't use the installed Node.js runtime, and it shouldn't ask the whatsapp-web.js version but the wwebjs-electron version. Anyway...
I'm trying to fix the issue myself considering maybe that's just whatsapp-web.js code that wasn't properly changed, thus I just need to change it to use puppeteer-in-electron instead of the normal puppeteer. I tried replacing the code that instanciates a new browser to use the existing electron browser like so:
But then it fails with
TypeError: Cannot read properties of undefined (reading 'setUserAgent')
when setting the page's user-agent on line 314. Thuspage = (await browser.pages())[0];
is returningundefined
. Then I checked puppeteer-in-electron docs and changed it as follows:Then finally WhatsApp opened, but got stuck on a loop saying "WhatsApp is out of date. Updating now..." and it never continues.
Edit: by the way, the console showed lots of "Prism is not defined" errors:
Edit 2: It started working again after I did the proposed changes from this whatsapp-web.js issue. I still need to test if my code is working.
Edit 3: It's working now! I guess you can just do the following changes in order to fix it for everyone.