H
H
Herman Coffman2021-11-08 13:36:10
Node.js
Herman Coffman, 2021-11-08 13:36:10

Why does the "document is not defined" error occur?

The code:

const butts = Array.prototype.filter.call(
    document.querySelectorAll('div[id^="start-ads-"] + div[id^="ads_id_"]'),
    div => /Таймер:\s*10\s*секунд\s*$/.test(div.textContent)
  ).map(e => e.previousElementSibling.querySelector('span[onclick]'));

Mistake:
C:\Users\User\Desktop\Test\aviso.js:24
document.querySelectorAll('div[id^="start-ads-"] + div[id^="ads_id_"]'),
^

ReferenceError: document is not defined
at getPic (C:\Users\User\Desktop\Test\aviso.js:24:5)


I use node.js, puppeteer.js and atom. dom.js is installed.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question