Skip to content

Instantly share code, notes, and snippets.

@ConnorNelson
Created January 2, 2020 06:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ConnorNelson/004efc500279323848178ab5dad42906 to your computer and use it in GitHub Desktop.
Save ConnorNelson/004efc500279323848178ab5dad42906 to your computer and use it in GitHub Desktop.
// google-chrome --headless --disable-gpu --remote-debugging-port=9222 <website>
// ssh -L localhost:1337:localhost:9222 <server>
// document.querySelector("#username").value = "<username>";
var attempts = 0;
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function loggingSleep(ms) {
while (ms > 0) {
document.title = '[' + attempts + '] Sleeping for ' + (ms/1000) + 's...';
await sleep(Math.min(ms, 5000));
ms -= Math.min(ms, 5000);
}
}
async function join_classes() {
while (true) {
try {
document.getElementsByTagName("frame")[0].contentDocument.getElementsByTagName("frame")[0].contentDocument.getElementsByTagName("frame")[0].contentDocument.getElementsByTagName("frame")[2].contentDocument.querySelector("#DERIVED_REGFRM1_LINK_ADD_ENRL\\$82\\$").click();
await loggingSleep(10 * 1000);
document.getElementsByTagName("frame")[0].contentDocument.getElementsByTagName("frame")[0].contentDocument.getElementsByTagName("frame")[0].contentDocument.getElementsByTagName("frame")[2].contentDocument.querySelector("#DERIVED_REGFRM1_SSR_PB_SUBMIT").click();
await loggingSleep(10 * 1000);
document.getElementsByTagName("frame")[0].contentDocument.getElementsByTagName("frame")[0].contentDocument.getElementsByTagName("frame")[0].contentDocument.getElementsByTagName("frame")[2].contentDocument.querySelector("#DERIVED_REGFRM1_SSR_LINK_STARTOVER\\$214\\$").click();
await loggingSleep(10 * 1000);
attempts += 1;
await loggingSleep(90 * 1000);
}
catch (err) {
console.log("Caught error");
}
}
}
join_classes();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment