Search code examples
javascriptgoogle-classroom

Simulating Clicking a span/div element, not working


I'm trying to make an automation tool for google classrooms to auto-submit my work for me, instead of having to go through 1-by-1 (I have more than 100 to be turned in), and I'm trying to make js press the submit work/mark as done button. I've tried with all the divs and spans, but it doesn't do anything. here's some screen shots: inspect elemet

script

alerting

mark as done the code:

var elementsArray = document.getElementsByClassName("uArJ5e TuHiFd UQuaGc Y5sE8d M9Bg4d");
alert(elementsArray[0].innerHTML);
var span = elementsArray[0];
var click = new Event('click');
span.dispatchEvent(click);

Trying to run the script makes the alert pop up, but nothing else happens. No errors appear in the console, and I'm wondering why this isn't working. Any answers would be nice, thanks.


Solution

  • maybe you can try span.click()