1"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([["17871"],{31731(e,r,s){s.r(r),s.d(r,{metadata:()=>n,default:()=>l,frontMatter:()=>a,contentTitle:()=>c,toc:()=>h,assets:()=>o});var n=JSON.parse('{"id":"api/puppeteer.page.screenshot","title":"Page.screenshot() method","description":"screenshot(): Promise<string>","source":"@site/versioned_docs/version-25.12.0/api/puppeteer.page.screenshot.md","sourceDirName":"api","slug":"/api/puppeteer.page.screenshot","permalink":"/api/puppeteer.page.screenshot","draft":false,"unlisted":false,"tags":[],"version":"25.12.0","frontMatter":{"sidebar_label":"Page.screenshot"},"sidebar":"api","previous":{"title":"Page.screencast","permalink":"/api/puppeteer.page.screencast"},"next":{"title":"Page.select","permalink":"/api/puppeteer.page.select"}}'),t=s(74848),i=s(28453);let a={sidebar_label:"Page.screenshot"},c="Page.screenshot() method",o={},h=[{value:"Signature",id:"signature",level:3},{value:"Parameters",id:"parameters",level:2},{value:"Remarks",id:"remarks",level:2},{value:"Signature",id:"signature-1",level:3},{value:"Parameters",id:"parameters-1",level:2}];function p(e){let r={a:"a",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",header:"header",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.header,{children:(0,t.jsx)(r.h1,{id:"pagescreenshot-method",children:"Page.screenshot() method"})}),"\n",(0,t.jsx)("h2",{id:"overload-1",children:"screenshot(): Promise<string>"}),"\n",(0,t.jsxs)(r.p,{children:["Captures a screenshot of this ",(0,t.jsx)(r.a,{href:"/api/puppeteer.page",children:"page"}),"."]}),"\n",(0,t.jsx)(r.h3,{id:"signature",children:"Signature"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-typescript",children:"class Page {\n screenshot(\n options: Readonly<ScreenshotOptions> & {\n encoding: 'base64';\n },\n ): Promise<string>;\n}\n"})}),"\n",(0,t.jsx)(r.h2,{id:"parameters",children:"Parameters"}),"\n",(0,t.jsxs)("table",{children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{children:(0,t.jsx)(r.p,{children:"Parameter"})}),(0,t.jsx)("th",{children:(0,t.jsx)(r.p,{children:"Type"})}),(0,t.jsx)("th",{children:(0,t.jsx)(r.p,{children:"Description"})})]})}),(0,t.jsx)("tbody",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)(r.p,{children:"options"})}),(0,t.jsx)("td",{children:(0,t.jsxs)(r.p,{children:["Readonly<",(0,t.jsx)(r.a,{href:"/api/puppeteer.screenshotoptions",children:"ScreenshotOptions"}),"> & { encoding: 'base64'; }"]})}),(0,t.jsx)("td",{children:(0,t.jsx)(r.p,{children:"Configures screenshot behavior."})})]})})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns:"})}),"\n",(0,t.jsx)(r.p,{children:"Promise<string>"}),"\n",(0,t.jsx)(r.h2,{id:"remarks",children:"Remarks"}),"\n",(0,t.jsxs)(r.p,{children:["While a screenshot is being taken in a ",(0,t.jsx)(r.a,{href:"/api/puppeteer.browsercontext",children:"BrowserContext"}),", the following methods will automatically wait for the screenshot to finish to prevent interference with the screenshot process: ",(0,t.jsx)(r.a,{href:"/api/puppeteer.browsercontext.newpage",children:"BrowserContext.newPage()"}),", ",(0,t.jsx)(r.a,{href:"/api/puppeteer.browser.newpage",children:"Browser.newPage()"}),", ",(0,t.jsx)(r.a,{href:"/api/puppeteer.page.close",children:"Page.close()"}),"."]}),"\n",(0,t.jsxs)(r.p,{children:["Calling ",(0,t.jsx)(r.a,{href:"/api/puppeteer.page.bringtofront",children:"Page.bringToFront()"})," will not wait for existing screenshot operations."]}),"\n",(0,t.jsx)("h2",{id:"overload-2",children:"screenshot(): Promise<Uint8Array>"}),"\n",(0,t.jsx)(r.h3,{id:"signature-1",children:"Signature"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-typescript",children:"class Page {\n screenshot(options?: Readonly<ScreenshotOptions>): Promise<Uint8Array>;\n}\n"})}),"\n",(0,t.jsx)(r.h2,{id:"parameters-1",children:"Parameters"}),"\n",(0,t.jsxs)("table",{children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{children:(0,t.jsx)(r.p,{children:"Parameter"})}),(0,t.jsx)("th",{children:(0,t.jsx)(r.p,{children:"Type"})}),(0,t.jsx)("th",{children:(0,t.jsx)(r.p,{children:"Description"})})]})}),(0,t.jsx)("tbody",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)(r.p,{children:"options"})}),(0,t.jsx)("td",{children:(0,t.jsxs)(r.p,{children:["Readonly<",(0,t.jsx)(r.a,{href:"/api/puppeteer.screenshotoptions",children:"ScreenshotOptions"}),">"]})}),(0,t.jsx)("td",{children:(0,t.jsx)(r.p,{children:(0,t.jsx)(r.em,{children:"(Optional)"})})})]})})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns:"})}),"\n",(0,t.jsx)(r.p,{children:"Promise<Uint8Array>"})]})}function l(e={}){let{wrapper:r}={...(0,i.R)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(p,{...e})}):p(e)}},28453(e,r,s){s.d(r,{R:()=>a,x:()=>c});var n=s(96540);let t={},i=n.createContext(t);function a(e){let r=n.useContext(i);return n.useMemo(function(){return"function"==typeof e?e(r):{...r,...e}},[r,e])}function c(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:a(e.components),n.createElement(i.Provider,{value:r},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.