Skip to content

Instantly share code, notes, and snippets.

@joeperpetua
Created November 21, 2023 16:46
Show Gist options
  • Save joeperpetua/ba3b51f53a2209e5c81ee50962a6c0f7 to your computer and use it in GitHub Desktop.
Save joeperpetua/ba3b51f53a2209e5c81ee50962a6c0f7 to your computer and use it in GitHub Desktop.
const sleep = async (time) => {
return new Promise(resolve => setTimeout(resolve, time));
}
(async () => {
let counter = 1;
while (true) {
console.log(`==== Exporting page ${counter} ====`);
await sleep(1000);
console.log(' Getting check...');
let checkAll = document.querySelector("#ext-gen93");
checkAll ? checkAll.click() : console.error("Check does not exist: ", checkAll);
await sleep(1000);
console.log(' Getting export...');
let exportButton = document.querySelector("#ext-gen623");
exportButton ? exportButton.click() : console.error("Export does not exist: ", exportButton);
await sleep(1000);
console.log(' Getting hide...');
let hideButton = document.querySelector('[aria-label="Hide"]');
hideButton ? hideButton.click() : console.error("Hide does not exist: ", hideButton);
await sleep(1000);
console.log(' Getting next...');
let nextPage = document.querySelector("#ext-gen652");
console.log(`==== Finished exporting page ${counter} ====`);
if (nextPage.ariaDisabled === 'true') {
console.log('==========================================================================');
console.log(` ==== Finished exporting ALL pages. Pages exported ${counter} ==== `);
console.log('==========================================================================');
break;
}
nextPage ? nextPage.click() : console.error("Next does not exist: ", nextPage);
await sleep(1000);
counter++;
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment