kohheepeace / mr-pdf

Generate PDF for document website.
https://www.npmjs.com/package/mr-pdf
MIT License
125 stars 41 forks source link

waitForRender <timeout> causes invalid selector and DOMException. #46

Open videki opened 2 years ago

videki commented 2 years ago

Running

mr-pdf --initialDocURLs='http://localhost:3000/docs/next' --waitForRender=5000 ....

causes the following error because the parameter is considered to be string in utils at the end in all cases, which expects it to be a selector:

` Retrieving html from http://localhost:3000/docs/next

Rendering... Error: Evaluation failed: DOMException: Failed to execute 'querySelector' on 'Document': '5000' is not a valid selector. at predicate (eval at waitForPredicatePageFunction (:2:21), :6:20) at eval (eval at waitForPredicatePageFunction (:2:21), :25:7) at pollMutation (puppeteer_evaluation_script:17:31) at waitForPredicatePageFunction (puppeteer_evaluation_script:9:18) at ExecutionContext._evaluateInternal (/Users/.../node_modules/puppeteer/lib/ExecutionContext.js:122:13) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async WaitTask.rerun (/Users/.../node_modules/puppeteer/lib/DOMWorld.js:570:17) -- ASYNC -- at ExecutionContext. (/Users/.../node_modules/puppeteer/lib/helper.js:111:15) at WaitTask.rerun (/Users/.../node_modules/puppeteer/lib/DOMWorld.js:570:65) at processTicksAndRejections (node:internal/process/task_queues:96:5) -- ASYNC -- at Frame. (/Users/.../node_modules/puppeteer/lib/helper.js:111:15) at Frame.waitFor (/Users/.../node_modules/puppeteer/lib/FrameManager.js:612:19) at Page.waitFor (/Users/.../node_modules/puppeteer/lib/Page.js:1113:29) at Object.generatePDF (/Users/.../node_modules/mr-pdf/lib/utils.js:23:32) at processTicksAndRejections (node:internal/process/task_queues:96:5) `

zebracookie commented 2 years ago

Anyone got a solution for that ? Images load inconsistently on my side and --waitForRender does not work.

Thanks :)

dannief commented 1 year ago

I am also getting this issue