schickling/chromeless

Better error handling when error occurs in expressionResult

Open

#207 建立於 2017年8月9日

在 GitHub 查看
 (0 留言) (3 反應) (0 負責人)TypeScript (13,240 star) (606 fork)batch import
APIenhancementhelp wanted

描述

const { Chromeless } = require('chromeless')

async function run() {
  const chromeless = new Chromeless()

  const screenshot = await chromeless
    .goto('https://www.google.com')
    .click('.icon') //click
    .click('.passenger') //click
    .wait('#resultStats')
    .screenshot()

  console.log(screenshot) // prints local file path or S3 url

  await chromeless.end()
}
run().catch(console.error.bind(console))

the error message: Error: TypeError: Cannot read property 'click' of undefined at expressionResult (:8:17) at :10:11 at :16:7 at D:\git\headless\node_modules\chromeless\dist\src\util.js:302:31 at step (D:\git\headless\node_modules\chromeless\dist\src\util.js:40:23) at Object.next (D:\git\headless\node_modules\chromeless\dist\src\util.js:21:53) at fulfilled (D:\git\headless\node_modules\chromeless\dist\src\util.js:12:58 )

I could not know which click failed from the error message.

貢獻者指南