so i run puppeteer bot (robot.js) in a loop every x seconds to open a tab , capture some data from a page and close the tab .... until next loop
so it works fine and i can see data log in the console but every while i get
opening page 1 -> ok
(node:11867) UnhandledPromiseRejectionWarning: Error: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
at CDPSession.send (/home/hostname/domains/example.com/robot/node_modules/puppeteer/lib/Connection.js:189:29)
at ExecutionContext.evaluateHandle (/home/hostname/domains/example.com/robot/node_modules/puppeteer/lib/ExecutionContext.js:89:75)
at ElementHandle.$ (/home/hostname/domains/example.com/robot/node_modules/puppeteer/lib/ElementHandle.js:272:50)
at Frame.$ (/home/hostname/domains/example.com/robot/node_modules/puppeteer/lib/FrameManager.js:357:34)
(node:11867) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
(node:11867) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
opening page 2 -> ok
bot done successfully ... closing tab for the next loop
as you can see i get a error telling me session has closed in the middle of process .... weird thing is that loop is success full and works without a problem
i've no idea what is cuzing this and why
so here is my question .... is there any way to get more information about what line is cuzing(or has anything to do with) this error and where is this happening in robot.js ?
all i see in the error stack is referencing puppeteer inner modules which is pretty much useless in this case for me
from pupeteer debuging : finding which line is cuzing the error
No comments:
Post a Comment