hi im trying to select a given div with in a class. The html is set up like so:
<div class="items">
<div>fist div</div>
<div>second div</div>
<div>third div</div>
</div>
<div class="items">
<div>fist div two</div>
<div>second div two</div>
<div>third div two</div>
</div>
<div class="items">
<div>fist div three</div>
<div>second div three</div>
<div>third div three</div>
</div>
my script is like this:
let info = await page.evaluate(() => {
let data = [];
let elements = document.getElementsByClassName("items");
let yr = elements[0].getElementsByTagName("div");
for (var i of yr) {
data.push(i.textContent);
}
return data;
});
this returns all the divs inn ann array like so
["fist div"],["second div"],["third div"]
what im trying to achive is to get all the divs inn all the classes. so it would look like:
[
["fist div"],["second div"],["third div"],
["fist div two"],["second div two"],["third div two"],
["fist div three"],["second div three"],["third div three"],
]
i was making a foor loop but i cant seem to ge it to work. any ideas?