Hello I am trying to scrape a web page and return all of the links inside example of the html element:
<a href="#/item/2sDSXbG">
<a href="#/item/4ssaSXbG">
<a href="#/item/Sawd432">
Here is my code:
let links = [];
let elements2 = document.querySelectorAll('a');
for (var element2 of elements2)
links.push(element2.textContent);
After I return the value and print it I get an Error telling me that my variable is not defined My Error:
UnhandledPromiseRejectionWarning: ReferenceError: links is not defined
End Goal: My goal is to be able to be able to create an array of all the items in the list. I would than later parse the information so that it is just the text after /item/