如何解决 Puppeteer 中的这个错误 我尝试使用 Puppeteer 填写表单

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

如何解决 Puppeteer 中的这个错误我尝试使用 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) 

确保等待关闭页面或浏览器,并同步调用后续实例。 https://github.com/puppeteer/puppeteer/issues/1947

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