Home > OS >  how to solve this Error in Puppeteer i try to FillUp form using Puppeteer
how to solve this Error in Puppeteer i try to FillUp form using Puppeteer

Time:03-24

how to solve this Error in Puppeteer i try to FillUp form using Puppeteer

2022-03-23 18:33:31.005 INFO  Error While WriteInputFieldsProtocol error (Input.dispatchKeyEvent): Target closed.
{"name":"ProtocolError","originalMessage":"","message":"Protocol error (Input.dispatchKeyEvent): Target closed."}
ProtocolError: Protocol error (Input.dispatchKeyEvent): Target closed.
    at /home/mypc/Documents/project/puppetor-script/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:230:24
    at new Promise (<anonymous>)
    at CDPSession.send (/home/mypc/Documents/project/puppetor-script/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:226:16)
    at next (/home/mypc/Documents/project/puppetor-script/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/index.js:32:41)
    at CDPSession.send (/home/mypc/Documents/project/puppetor-script/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/index.js:57:18)
    at Keyboard.up (/home/mypc/Documents/project/puppetor-script/node_modules/puppeteer/lib/cjs/puppeteer/common/Input.js:168:28)
    at Keyboard.press (/home/mypc/Documents/project/puppetor-script/node_modules/puppeteer/lib/cjs/puppeteer/common/Input.js:258:20)
    at async Keyboard.type (/home/mypc/Documents/project/puppetor-script/node_modules/puppeteer/lib/cjs/puppeteer/common/Input.js:224:17)
    at async ElementHandle.type (/home/mypc/Documents/project/puppetor-script/node_modules/puppeteer/lib/cjs/puppeteer/common/JSHandle.js:674:9)
    at async Object._this.writeInputField (/home/mypc/Documents/project/puppetor-script/functions.js:514:21) 

CodePudding user response:

Make sure you await closing the page or browser and that subsequent instances are called synchronously. https://github.com/puppeteer/puppeteer/issues/1947

...
await page.close();
...
or
...
await browser.close();
...
  • Related