christopherwk210 / site-scan

CLI for capturing website screenshots, powered by puppeteer.
MIT License
136 stars 13 forks source link

Error #9

Open world33 opened 5 years ago

world33 commented 5 years ago

Hi Chris, I updated the package but now I get the following error:

Your environment has been set up for using Node.js 10.8.0 (x64) and npm.

C:\Users\Fabio>ss --sleep 1 --path D:\screenshots\ -x 1366 -y 768 aou.edu.lb udm .ac.mz ustm.ac.mz unizambeze.ac.mz unipiaget.ac.mz up.ac.mz unilurio.ac.mz sadja d.ac.ir eek.ee lennuakadeemia.ee southvalleyuniversity.com kkmu.ac.zm supershine university.net icuzambia.net chresouniversity.org hvu.edu.vn sgu.edu.vn ucmother .ac.ae imc.gov.ae wus.edu.pk uobs.edu.pk szabmu.edu.pk sbbuvas.edu.pk rmc.edu.pk

Launching chrome... ? Done.

Loading http://aou.edu.lb... (node:7612) UnhandledPromiseRejectionWarning: Error: Execution context was destr oyed, most likely because of a navigation. at rewriteError (C:\Users\Fabio\AppData\Roaming\npm\node_modules\site-scan\n ode_modules\puppeteer\lib\ExecutionContext.js:144:15) at process._tickCallback (internal/process/next_tick.js:68:7) -- ASYNC -- at ExecutionContext. (C:\Users\Fabio\AppData\Roaming\npm\node_mod ules\site-scan\node_modules\puppeteer\lib\helper.js:144:27) at ExecutionContext.evaluate (C:\Users\Fabio\AppData\Roaming\npm\node_module s\site-scan\node_modules\puppeteer\lib\ExecutionContext.js:58:31) at ExecutionContext. (C:\Users\Fabio\AppData\Roaming\npm\node_mod ules\site-scan\node_modules\puppeteer\lib\helper.js:145:23) at Frame.evaluate (C:\Users\Fabio\AppData\Roaming\npm\node_modules\site-scan \node_modules\puppeteer\lib\FrameManager.js:439:20) at process._tickCallback (internal/process/next_tick.js:68:7) -- ASYNC -- at Frame. (C:\Users\Fabio\AppData\Roaming\npm\node_modules\site-s can\node_modules\puppeteer\lib\helper.js:144:27) at Page.evaluate (C:\Users\Fabio\AppData\Roaming\npm\node_modules\site-scan node_modules\puppeteer\lib\Page.js:728:43) at Page. (C:\Users\Fabio\AppData\Roaming\npm\node_modules\site-sc an\node_modules\puppeteer\lib\helper.js:145:23) at takeScreenshot (C:\Users\Fabio\AppData\Roaming\npm\node_modules\site-scan \lib\site-scan.js:149:25) at process._tickCallback (internal/process/next_tick.js:68:7) (node:7612) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:7612) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre cated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

christopherwk210 commented 5 years ago

Ah, this was failing because the first site in your list has a JS redirect it seems. I was able to fix the issue in 479b768cc7ed02c6f0eee3ef3e34505da90c8f3c by adding support for websites with with redirects or post-load single time JS navigations.

I tried running the command as you supplied after updating and it worked as expected. Some of the websites failed, but that seems because they aren't valid URLs rather than an issue with site-scan, so your list might need adjusting before completely passing.

world33 commented 5 years ago

Thank you very much Chris!! Please consider to add an option in future updates where every time it fails to load a url or generate a screenshot it creates automatically a completely transparent or white screenshot instead. That would really help when, having to generate in bulk hundreds of screenshots, it is hard to take track of the missing screenshots due to load errors. Better to have a transparent/white screenshot than a missing image file placeholder. Thanks again!!!