In JavaScript, if you need to read or manipulate all elements, you can pass a * to the getElementsByTagName
method so it will return all elements in a page.
let your_variable = document.getElementsByTagName("*");
for (let i=1; i<your_variable.length; i++){
// Do something with the element here
}