schickling/chromeless

Why after waitiing, the 'click' is undefined

開放

#215 建立於 2017年8月10日

 (2 則留言) (0 個反應) (0 位負責人)TypeScript (606 個分叉)batch import
discussionenhancementhelp wantedquestion

倉庫指標

星標
 (13,240 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

const { Chromeless } = require('chromeless')
async function run() {
  const chromeless = new Chromeless()

  const screenshot = await chromeless
    .goto('https://www.google.com')
    .wait('div[data-type="planName"]')
    .click('div[data-type="planName"]') //after wait(), 'click' is undefined
    .screenshot()

  console.log(screenshot) 
  await chromeless.end()
}

run().catch(console.error.bind(console))

the error message: (node:10204) UnhandledPromiseRejectionWarning: Unhandled promise rejection (reje ction id: 1): Error: TypeError: Cannot read property 'click' of undefined at expressionResult (:8:17) at :9:11 at :15:7

Why after waitiing, the 'click 'is undefined? I often encounter this situation.

貢獻者指南