Puppeteer in NodeJS reports 'Error: Node is either not visible or not an HTMLElement'

后端 未结 4 2257
执笔经年
执笔经年 2021-02-18 18:05

I\'m using \'puppeteer\' for NodeJS to test a specific website. It seems to work fine in most case, but some places it reports:

Error: Node is either not

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-18 18:49

    For anyone still having trouble this worked for me:

    await page.evaluate(()=>document.querySelector('#sign-in-btn').click())

    Basically just get the element in a different way, then click it.

    The reason I had to do this was because I was trying to click a button in a notification window which sits outside the rest of the app (and Chrome seemed to think it was invisible even if it was not).

提交回复
热议问题