'web scraping code not working when there is a table in the website

So i started web scraping and i created a js code it works perfectly until i came across a problem , when there is a table in the website where i need information from this code is not working

var rows = document.getElementsByClassName('lo');
var row;
for (var i = rows.length - 1; i >= 0; i--) {
    row = rows[i];
    if(row.innerHTML.includes('\"blogos l417\"')) {
        var event = new Event('mouseover');
        row.children[1].children[0].dispatchEvent(event);
        break;
    }
}

If someone could help i would be very thankful , also i am a beginner and a friend helped me in creating this code , so if you could explain with terms more beginner friendly , thank you in advance

Uncaught TypeError: Cannot read properties of undefined (reading 'dispatchEvent') at :7:37



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source