javascript - Puppeteer: interact with dom in waitForSelector handler -
when use puppeteer js web crawler, in waitforselector
handler can use console.log
without trouble:
page .waitforselector('input[value=update]') .then(() => { console.log('this is'); console.log('it'); });
but have error when want interact dom:
page .waitforselector('input[value=update]') .then(() => { const inputvalidate = await page.$('input[value=update]'); });
this code triggers error:
const inputvalidate = await page.$('input[value=update]'); ^^^^
syntaxerror: unexpected identifier @ createscript (vm.js:74:10) @ object.runinthiscontext (vm.js:116:10) @ module._compile (module.js:537:28) @ object.module._extensions..js (module.js:584:10) @ module.load (module.js:507:32) @ trymoduleload (module.js:470:12) @ function.module._load (module.js:462:3) @ function.module.runmain (module.js:609:10) @ startup (bootstrap_node.js:158:16) @ bootstrap_node.js:598:3
do know how intercat dom in waitforselector
handler without trigger error?
page .waitforselector('input[value=update]') .then(async() => { const inputvalidate = await page.$('input[value=update]'); });
Comments
Post a Comment