问题
Is there away to capture a screenshot of the full page, including what is below the fold, in a Chrome Extension?
The captureVisibleTab seems to be limited to what is displayed within the visible area.
回答1:
You're limited to capturing the visible page via captureVisibleTab unless you use Flash or NPAPI.
回答2:
The standard approach seems to be to scroll around the page and capture screenshots at each part and then stick them all together. The official google screen capture plugin does this, but I found it to be buggy (at least on Mac OSX), so I wrote my own full page screen capture extension.
Source code here (relevant code in page.js and popup.js).
回答3:
On Macs, while not a Chrome extension, you can use the following AppleScript to automate the process found here:
https://zapier.com/blog/full-page-screenshots-in-chrome/
tell application "Google Chrome" to activate
tell application "System Events"
keystroke "i" using {option down, command down}
delay 0.3
keystroke "p" using {shift down, command down}
delay 0.3
keystroke "Full"
delay 0.5
key code 76
end tell
Open ScriptEditor and paste that script in. Save it as a file wherever you need it locally. When you run it by pressing play in ScriptEditor, it will automatically save a full screenshot of the active tab to your Downloads folder.
回答4:
Chrome 59 adds a new feature in DevTools called Capture full-size screenshot. But I don't know whether this API can be called by extensions.
来源:https://stackoverflow.com/questions/65786002/embed-js-code-in-the-for-loop-of-the-tabs-array-to-get-full-window-length-page-j