gildas-lormeau / single-file-cli

CLI tool for saving a faithful copy of a complete web page in a single HTML file (based on SingleFile)
GNU Affero General Public License v3.0
602 stars 63 forks source link

include-infobar option causes error #9

Closed alirezafarnoosh closed 2 years ago

alirezafarnoosh commented 2 years ago

Describe the bug When I do not use --include-infobar=true on the CLI, single-file works correctly; when I do include it, no matter where I include it, I get an error that starts with Stack: Error: Evaluation failed: ReferenceError: infobar is not defined.

To Reproduce Steps to reproduce the behavior:

In the terminal, enter the following: D:\work\single-file-cli-master>single-file.bat https://www.wikipedia.org wikipedia.html --browser-executable-path="C:\Program Files\Google\Chrome\Application\chrome.exe" --include-infobar=true

This correctly downloads the webpage & creates the html file on my Desktop. However, if I include --include-infobar=true in the command, it gives an error & the webpage is not saved on my Desktop.

'D:\work\single-file-cli-master>single-file.bat https://www.wikipedia.org wikipedia.html --browser-executable-path="C:\Program Files\Google\Chrome\Application\chrome.exe" --include-infobar=true'

Evaluation failed: ReferenceError: infobar is not defined
    at pptr://__puppeteer_evaluation_script__:4:5 URL: https://www.wikipedia.org
Stack: Error: Evaluation failed: ReferenceError: infobar is not defined
    at pptr://__puppeteer_evaluation_script__:4:5
    at ExecutionContext._ExecutionContext_evaluate (D:\work\node_modules\puppeteer-core\lib\cjs\puppeteer\common\ExecutionContext.js:271:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ExecutionContext.evaluate (D:\work\node_modules\puppeteer-core\lib\cjs\puppeteer\common\ExecutionContext.js:118:16)
    at async getPageData (D:\work\single-file-cli-master\back-ends\puppeteer.js:139:10)
    at async exports.getPageData (D:\work\single-file-cli-master\back-ends\puppeteer.js:51:10)
    at async capturePage (D:\work\single-file-cli-master\single-file-cli-api.js:253:20)
    at async runNextTask (D:\work\single-file-cli-master\single-file-cli-api.js:174:20)
    at async Promise.all (index 0)
    at async capture (D:\work\single-file-cli-master\single-file-cli-api.js:125:2)
    at async run (D:\work\single-file-cli-master\single-file:54:2

Expected behavior I expect the webpage to download without the error.

Environment

OS: windows 11 21H2 Browser: Chrome Version: 104.0.5112.102 (Official Build) (64-bit) Additional Context This error occurs in wsl linux - windows - nodejs ver 13 , 16 ,18 its work well with --include-infobar=false or without --include-infobar. the --include-infobar=true works well with single-fileZ with same usage

gildas-lormeau commented 2 years ago

Thank you for the detailed report. This error was due to some obsolete code. It's fixed in the version 1.0.17.