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

后端 未结 4 2243
执笔经年
执笔经年 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 19:00

    I know I’m late to the party but I discovered an edge case that gave me a lot of grief, and this thread, so figured I’d post my findings.

    The culprit: CSS

    scroll-behavior: smooth
    

    If you have this you will have a bad time.

    The solution:

    await page.addStyleTag({ content: "{scroll-behavior: auto !important;}" });
    

    Hope this helps some of you.

提交回复
热议问题