schickling/chromeless

Better error handling when error occurs in expressionResult

Open

Aperta il 9 ago 2017

Vedi su GitHub
 (0 commenti) (3 reazioni) (0 assegnatari)TypeScript (13.240 star) (606 fork)batch import
APIenhancementhelp wanted

Descrizione

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.

Guida contributor