升级Puppeteer之后,Puppeteer脚本突然停止工作

时间:2018-11-15 19:36:04

标签: chromium puppeteer

我有一个操纵up的脚本,用来重启调制解调器。我猜它已经工作了大约一年了,没有问题。 5天前它停止工作了。我一直在研究它,意识到在运行它时出现了我以前不曾遇到的错误,脚本失败了。问题是我什么都没改变。据我所知,HTML也没有改变,但是失败了。所以我想知道铬或木偶中是否有错误,或者它以某种方式处理问题?

这里是带有https://codepen.io/michaelbierman/pen/qQjdYR的codepen

  1. HTML页面
  2. 木偶剧本

错误

ERROR OUTPUT

星期四11/15/2018 11:14:04,登录... 未处理的拒绝:Promise(新页)Promise {    错误:找不到用于选择器的节点:#id_username     在断言处(/Users/bierman/Documents/Applications/bin/arris/node_modules/puppeteer/lib/helper.js:278:11)     在Frame.type(/Users/bierman/Documents/Applications/bin/arris/node_modules/puppeteer/lib/FrameManager.js:771:5)     在     在process._tickCallback(内部/进程/next_tick.js:188:7)   -异步-     在帧。 (/Users/bierman/Documents/Applications/bin/arris/node_modules/puppeteer/lib/helper.js:144:27)     在Page.type(/Users/bierman/Documents/Applications/bin/arris/node_modules/puppeteer/lib/Page.js:971:29)     在/Users/bierman/Documents/Applications/bin/arris/arristest.js:49:13     在     在process._tickCallback(internal / process / next_tick.js:188:7)}原因:错误:未找到选择器的节点:#id_username     在断言处(/Users/bierman/Documents/Applications/bin/arris/node_modules/puppeteer/lib/helper.js:278:11)     在Frame.type(/Users/bierman/Documents/Applications/bin/arris/node_modules/puppeteer/lib/FrameManager.js:771:5)     在     在process._tickCallback(内部/进程/next_tick.js:188:7)   -异步-     在帧。 (/Users/bierman/Documents/Applications/bin/arris/node_modules/puppeteer/lib/helper.js:144:27)     在Page.type(/Users/bierman/Documents/Applications/bin/arris/node_modules/puppeteer/lib/Page.js:971:29)     在/Users/bierman/Documents/Applications/bin/arris/arristest.js:49:13     在     在process._tickCallback(内部/进程/next_tick.js:188:7) /Users/bierman/Documents/Applications/bin/arris/arristest.js:29     browser.close();     ^

ReferenceError:未定义浏览器     在process.on(/Users/bierman/Documents/Applications/bin/arris/arristest.js:29:2)     在emitTwo(events.js:126:13)     在process.emit(events.js:214:7)     在emitPendingUnhandledRejections(internal / process / promises.js:108:22)     在process._tickCallback(内部/进程/next_tick.js:189:7) BigMac:bin michael $ / usr / local / bin / node /Users/bierman/Documents/Applications/bin/arris/arristest.js 2018年11月15日星期四11:20:29,登录... 2018年11月15日星期四11:20:36,回家... 未处理的拒绝:Promise(新页)Promise {    错误:找不到选择器的节点:#alertExitButton     在断言处(/Users/bierman/Documents/Applications/bin/arris/node_modules/puppeteer/lib/helper.js:278:11)     在Frame.click(/Users/bierman/Documents/Applications/bin/arris/node_modules/puppeteer/lib/FrameManager.js:704:5)     在     在process._tickCallback(内部/进程/next_tick.js:188:7)   -异步-     在帧。 (/Users/bierman/Documents/Applications/bin/arris/node_modules/puppeteer/lib/helper.js:144:27)     在Page.click上(/Users/bierman/Documents/Applications/bin/arris/node_modules/puppeteer/lib/Page.js:932:29)     在/Users/bierman/Documents/Applications/bin/arris/arristest.js:62:13     在     在process._tickCallback(internal / process / next_tick.js:188:7)}原因:错误:没有为选择器找到节点:#alertExitButton     在断言处(/Users/bierman/Documents/Applications/bin/arris/node_modules/puppeteer/lib/helper.js:278:11)     在Frame.click(/Users/bierman/Documents/Applications/bin/arris/node_modules/puppeteer/lib/FrameManager.js:704:5)     在     在process._tickCallback(内部/进程/next_tick.js:188:7)   -异步-     在帧。 (/Users/bierman/Documents/Applications/bin/arris/node_modules/puppeteer/lib/helper.js:144:27)     在Page.click上(/Users/bierman/Documents/Applications/bin/arris/node_modules/puppeteer/lib/Page.js:932:29)     在/Users/bierman/Documents/Applications/bin/arris/arristest.js:62:13     在     在process._tickCallback(内部/进程/next_tick.js:188:7) /Users/bierman/Documents/Applications/bin/arris/arristest.js:29     browser.close();     ^

ReferenceError:未定义浏览器     在process.on(/Users/bierman/Documents/Applications/bin/arris/arristest.js:29:2)     在emitTwo(events.js:126:13)     在process.emit(events.js:214:7)     在emitPendingUnhandledRejections(internal / process / promises.js:108:22)     在process._tickCallback(internal / process / next_tick.js:189:7)

1 个答案:

答案 0 :(得分:1)

尝试一下:

npm uninstall chromium
npm uninstall puppeteer
npm i chromium@1
npm i puppeteer