3mora2 / WPP_Whatsapp

WPP_Whatsapp aim of exporting functions from WhatsApp Web to the python, which can be used to support the creation of any interaction, such as customer service, media sending, intelligence recognition based on phrases artificial and many other things, use your imagination
MIT License
77 stars 14 forks source link

stuck whatapp web window #55

Open MominIqbal-1234 opened 1 week ago

MominIqbal-1234 commented 1 week ago

freez this state and then error and crash browser

image

Error

05-Nov-24 05:25:35 - ERROR - getQrCode Traceback (most recent call last): File "/home/momin/.local/lib/python3.12/site-packages/WPP_Whatsapp/api/layers/HostLayer.py", line 380, in __getQrCode qr_result = await self.scrapeImg() ^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/WPP_Whatsapp/api/layers/HostLayer.py", line 684, in scrapeImg click = await self.ThreadsafeBrowser.page_evaluate("""() => { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/WPP_Whatsapp/controllers/browser.py", line 16, in wrapper return await method(self, *args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/WPP_Whatsapp/controllers/browser.py", line 162, in page_evaluate return await super().page_evaluate(*args, page=page, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/PlaywrightSafeThread/browser/threadsafe_browser.py", line 538, in page_evaluate return await self.create_task(page.evaluate(args, kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/PlaywrightSafeThread/browser/threadsafe_browser.py", line 309, in create_task return await self.loop.create_task(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/playwright/async_api/_generated.py", line 8491, in evaluate await self._impl_obj.evaluate( File "/home/momin/.local/lib/python3.12/site-packages/playwright/_impl/_page.py", line 469, in evaluate return await self._main_frame.evaluate(expression, arg) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/playwright/_impl/_frame.py", line 278, in evaluate await self._channel.send( File "/home/momin/.local/lib/python3.12/site-packages/playwright/_impl/_connection.py", line 59, in send return await self._connection.wrap_api_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/playwright/_impl/_connection.py", line 520, in wrap_api_call raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None playwright._impl._errors.Error: Page.evaluate: TypeError: Cannot read properties of null (reading 'closest') at eval (eval at evaluate (:234:30), :3:47) at UtilityScript.evaluate (:241:19) at UtilityScript. (:1:44) 05-Nov-24 05:26:44 - ERROR - getQrCode Traceback (most recent call last): File "/home/momin/.local/lib/python3.12/site-packages/WPP_Whatsapp/api/layers/HostLayer.py", line 380, in getQrCode qr_result = await self.scrapeImg() ^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/WPP_Whatsapp/api/layers/HostLayer.py", line 684, in scrapeImg click = await self.ThreadsafeBrowser.page_evaluate("""() => { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/WPP_Whatsapp/controllers/browser.py", line 16, in wrapper return await method(self, *args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/WPP_Whatsapp/controllers/browser.py", line 162, in page_evaluate return await super().page_evaluate(*args, page=page, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/PlaywrightSafeThread/browser/threadsafe_browser.py", line 538, in page_evaluate return await self.create_task(page.evaluate(args, kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/PlaywrightSafeThread/browser/threadsafe_browser.py", line 309, in create_task return await self.loop.create_task(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/playwright/async_api/_generated.py", line 8491, in evaluate await self._impl_obj.evaluate( File "/home/momin/.local/lib/python3.12/site-packages/playwright/_impl/_page.py", line 469, in evaluate return await self._main_frame.evaluate(expression, arg) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/playwright/_impl/_frame.py", line 278, in evaluate await self._channel.send( File "/home/momin/.local/lib/python3.12/site-packages/playwright/_impl/_connection.py", line 59, in send return await self._connection.wrap_api_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/playwright/_impl/_connection.py", line 520, in wrap_api_call raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None playwright._impl._errors.Error: Page.evaluate: TypeError: Cannot read properties of null (reading 'closest') at eval (eval at evaluate (:234:30), :3:47) at UtilityScript.evaluate (:241:19) at UtilityScript. (:1:44) 05-Nov-24 05:27:00 - ERROR - __getQrCode Traceback (most recent call last): File "/home/momin/.local/lib/python3.12/site-packages/WPP_Whatsapp/api/layers/HostLayer.py", line 380, in getQrCode qr_result = await self.scrapeImg() ^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/WPP_Whatsapp/api/layers/HostLayer.py", line 684, in scrapeImg click = await self.ThreadsafeBrowser.page_evaluate("""() => { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/WPP_Whatsapp/controllers/browser.py", line 16, in wrapper return await method(self, *args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/WPP_Whatsapp/controllers/browser.py", line 162, in page_evaluate return await super().page_evaluate(*args, page=page, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/PlaywrightSafeThread/browser/threadsafe_browser.py", line 538, in page_evaluate return await self.create_task(page.evaluate(args, kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/PlaywrightSafeThread/browser/threadsafe_browser.py", line 309, in create_task return await self.loop.create_task(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/playwright/async_api/_generated.py", line 8491, in evaluate await self._impl_obj.evaluate( File "/home/momin/.local/lib/python3.12/site-packages/playwright/_impl/_page.py", line 469, in evaluate return await self._main_frame.evaluate(expression, arg) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/playwright/_impl/_frame.py", line 278, in evaluate await self._channel.send( File "/home/momin/.local/lib/python3.12/site-packages/playwright/_impl/_connection.py", line 59, in send return await self._connection.wrap_api_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/playwright/_impl/_connection.py", line 520, in wrap_api_call raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None playwright._impl._errors.Error: Page.evaluate: TypeError: Cannot read properties of null (reading 'closest') at eval (eval at evaluate (:234:30), :3:47) at UtilityScript.evaluate (:241:19) at UtilityScript. (:1:44) 05-Nov-24 05:27:00 - ERROR - __getQrCode Traceback (most recent call last): File "/home/momin/.local/lib/python3.12/site-packages/WPP_Whatsapp/api/layers/HostLayer.py", line 380, in __getQrCode qr_result = await self.scrapeImg() ^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/WPP_Whatsapp/api/layers/HostLayer.py", line 684, in scrapeImg click = await self.ThreadsafeBrowser.page_evaluate("""() => { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/WPP_Whatsapp/controllers/browser.py", line 16, in wrapper return await method(self, *args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/WPP_Whatsapp/controllers/browser.py", line 162, in page_evaluate return await super().page_evaluate(*args, page=page, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/PlaywrightSafeThread/browser/threadsafe_browser.py", line 538, in page_evaluate return await self.create_task(page.evaluate(args, kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/PlaywrightSafeThread/browser/threadsafe_browser.py", line 309, in create_task return await self.loop.create_task(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/playwright/async_api/_generated.py", line 8491, in evaluate await self._impl_obj.evaluate( File "/home/momin/.local/lib/python3.12/site-packages/playwright/_impl/_page.py", line 469, in evaluate return await self._main_frame.evaluate(expression, arg) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/playwright/_impl/_frame.py", line 278, in evaluate await self._channel.send( File "/home/momin/.local/lib/python3.12/site-packages/playwright/_impl/_connection.py", line 59, in send return await self._connection.wrap_api_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/playwright/_impl/_connection.py", line 520, in wrap_api_call raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None playwright._impl._errors.Error: Page.evaluate: TypeError: Cannot read properties of null (reading 'closest') at eval (eval at evaluate (:234:30), :3:47) at UtilityScript.evaluate (:241:19) at UtilityScript. (:1:44) Traceback (most recent call last): File "/home/momin/Documents/whatsChat/simple_test.py", line 6, in client = creator.start() ^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/WPP_Whatsapp/controllers/initializer.py", line 133, in start self.create_sync() File "/home/momin/.local/lib/python3.12/site-packages/WPP_Whatsapp/controllers/initializer.py", line 157, in create_sync is_logged = self.client.waitForLogin() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/momin/.local/lib/python3.12/site-packages/WPP_Whatsapp/api/layers/HostLayer.py", line 568, in waitForLogin raise Exception('Failed to read the QRCode') Exception: Failed to read the QRCode

3mora2 commented 1 week ago

make sure you update playwright(you can uninstall and re install it) if still not work try firfox and new session

MominIqbal-1234 commented 1 week ago

now its working fine without any changes i think so its problem from whatsapp side because every time change web qr code page i try multiple time its changes many time now i continue to testing