diff --git a/userscript.js b/userscript.js index 11dd3ea..0936759 100644 --- a/userscript.js +++ b/userscript.js @@ -62,11 +62,14 @@ function clickExportOnAllDocuments(allDocuments) { setTimeout(() => { doc.dispatchEvent(event); // Then get the context menu to click on "Export" after short delay - let exportButton = document.getElementById("exportPdfButton"); - exportButton.click(); - // Click out of context menu to allow other context menu to pop - let outer = document.getElementById("fullScreenModalDismissibleArea"); - outer.click(); + setTimeout(() => { + let exportButton = document.getElementById("exportPdfButton"); + exportButton.click(); + // Click out of context menu to allow other context menu to pop + let outer = document.getElementById("fullScreenModalDismissibleArea"); + outer.click(); + }, 100); }, 500*i); + i += 1; }) } \ No newline at end of file