puppeteer/assets/js/264fd333.905caf77.js
release-please[bot] 07b60feacc deploy: cde1efb962
2024-05-06 08:01:08 +00:00

2 lines
66 KiB
JavaScript

/*! For license information please see 264fd333.905caf77.js.LICENSE.txt */
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[61927],{51489:(e,s,r)=>{r.r(s),r.d(s,{assets:()=>c,contentTitle:()=>d,default:()=>o,frontMatter:()=>n,metadata:()=>a,toc:()=>l});var t=r(85893),i=r(11151);const n={sidebar_label:"Page"},d="Page class",a={id:"api/puppeteer.page",title:"Page class",description:"Page provides methods to interact with a single tab or extension background page in the browser.",source:"@site/versioned_docs/version-22.8.0/api/puppeteer.page.md",sourceDirName:"api",slug:"/api/puppeteer.page",permalink:"/api/puppeteer.page",draft:!1,unlisted:!1,tags:[],version:"22.8.0",frontMatter:{sidebar_label:"Page"},sidebar:"api",previous:{title:"BrowserContext.waitForTarget",permalink:"/api/puppeteer.browsercontext.waitfortarget"},next:{title:"Page.$",permalink:"/api/puppeteer.page._"}},c={},l=[{value:"Signature:",id:"signature",level:4},{value:"Remarks",id:"remarks",level:2},{value:"Example 1",id:"example-1",level:2},{value:"Example 2",id:"example-2",level:2},{value:"Properties",id:"properties",level:2},{value:"Methods",id:"methods",level:2}];function h(e){const s={a:"a",admonition:"admonition",code:"code",em:"em",h1:"h1",h2:"h2",h4:"h4",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.h1,{id:"page-class",children:"Page class"}),"\n",(0,t.jsxs)(s.p,{children:["Page provides methods to interact with a single tab or ",(0,t.jsx)(s.a,{href:"https://developer.chrome.com/extensions/background_pages",children:"extension background page"})," in the browser."]}),"\n",(0,t.jsx)(s.admonition,{type:"note",children:(0,t.jsx)(s.p,{children:"One Browser instance might have multiple Page instances."})}),"\n",(0,t.jsx)(s.h4,{id:"signature",children:"Signature:"}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-typescript",children:"export declare abstract class Page extends EventEmitter<PageEvents>\n"})}),"\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.strong,{children:"Extends:"})," ",(0,t.jsx)(s.a,{href:"/api/puppeteer.eventemitter",children:"EventEmitter"}),"<",(0,t.jsx)(s.a,{href:"/api/puppeteer.pageevents",children:"PageEvents"}),">"]}),"\n",(0,t.jsx)(s.h2,{id:"remarks",children:"Remarks"}),"\n",(0,t.jsxs)(s.p,{children:["The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the ",(0,t.jsx)(s.code,{children:"Page"})," class."]}),"\n",(0,t.jsx)(s.h2,{id:"example-1",children:"Example 1"}),"\n",(0,t.jsx)(s.p,{children:"This example creates a page, navigates it to a URL, and then saves a screenshot:"}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-ts",children:"import puppeteer from 'puppeteer';\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'screenshot.png'});\n await browser.close();\n})();\n"})}),"\n",(0,t.jsxs)(s.p,{children:["The Page class extends from Puppeteer's ",(0,t.jsx)(s.a,{href:"/api/puppeteer.eventemitter",children:"EventEmitter"})," class and will emit various events which are documented in the ",(0,t.jsx)(s.a,{href:"/api/puppeteer.pageevent",children:"PageEvent"})," enum."]}),"\n",(0,t.jsx)(s.h2,{id:"example-2",children:"Example 2"}),"\n",(0,t.jsxs)(s.p,{children:["This example logs a message for a single page ",(0,t.jsx)(s.code,{children:"load"})," event:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-ts",children:"page.once('load', () => console.log('Page loaded!'));\n"})}),"\n",(0,t.jsxs)(s.p,{children:["To unsubscribe from events use the ",(0,t.jsx)(s.a,{href:"/api/puppeteer.eventemitter.off",children:"EventEmitter.off()"})," method:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-ts",children:"function logRequest(interceptedRequest) {\n console.log('A request was made:', interceptedRequest.url());\n}\npage.on('request', logRequest);\n// Sometime later...\npage.off('request', logRequest);\n"})}),"\n",(0,t.jsx)(s.h2,{id:"properties",children:"Properties"}),"\n",(0,t.jsxs)("table",{children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{children:(0,t.jsx)(s.p,{children:"Property"})}),(0,t.jsx)("th",{children:(0,t.jsx)(s.p,{children:"Modifiers"})}),(0,t.jsx)("th",{children:(0,t.jsx)(s.p,{children:"Type"})}),(0,t.jsx)("th",{children:(0,t.jsx)(s.p,{children:"Description"})})]})}),(0,t.jsxs)("tbody",{children:[(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"accessibility",children:"accessibility"})}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:(0,t.jsx)(s.code,{children:"readonly"})})}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:(0,t.jsx)(s.a,{href:"/api/puppeteer.accessibility",children:"Accessibility"})})}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["The Accessibility class provides methods for inspecting the browser's accessibility tree. The accessibility tree is used by assistive technology such as ",(0,t.jsx)(s.a,{href:"https://en.wikipedia.org/wiki/Screen_reader",children:"screen readers"})," or ",(0,t.jsx)(s.a,{href:"https://en.wikipedia.org/wiki/Switch_access",children:"switches"}),"."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsx)(s.p,{children:"Accessibility is a very platform-specific thing. On different platforms, there are different screen readers that might have wildly different output."}),(0,t.jsx)(s.p,{children:'Blink - Chrome\'s rendering engine - has a concept of "accessibility tree", which is then translated into different platform-specific APIs. Accessibility namespace gives users access to the Blink Accessibility Tree.'}),(0,t.jsx)(s.p,{children:'Most of the accessibility tree gets filtered out when converting from Blink AX Tree to Platform-specific AX-Tree or by assistive technologies themselves. By default, Puppeteer tries to approximate this filtering, exposing only the "interesting" nodes of the tree.'}),(0,t.jsxs)(s.p,{children:["The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the ",(0,t.jsx)(s.code,{children:"Accessibility"})," class."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"coverage",children:"coverage"})}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:(0,t.jsx)(s.code,{children:"readonly"})})}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:(0,t.jsx)(s.a,{href:"/api/puppeteer.coverage",children:"Coverage"})})}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"The Coverage class provides methods to gather information about parts of JavaScript and CSS that were used by the page."}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["To output coverage in a form consumable by ",(0,t.jsx)(s.a,{href:"https://github.com/istanbuljs",children:"Istanbul"}),", see ",(0,t.jsx)(s.a,{href:"https://github.com/istanbuljs/puppeteer-to-istanbul",children:"puppeteer-to-istanbul"}),"."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"keyboard",children:"keyboard"})}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:(0,t.jsx)(s.code,{children:"readonly"})})}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:(0,t.jsx)(s.a,{href:"/api/puppeteer.keyboard",children:"Keyboard"})})}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["Keyboard provides an api for managing a virtual keyboard. The high level api is ",(0,t.jsx)(s.a,{href:"/api/puppeteer.keyboard.type",children:"Keyboard.type()"}),", which takes raw characters and generates proper keydown, keypress/input, and keyup events on your page."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["For finer control, you can use ",(0,t.jsx)(s.a,{href:"/api/puppeteer.keyboard.down",children:"Keyboard.down()"}),", ",(0,t.jsx)(s.a,{href:"/api/puppeteer.keyboard.up",children:"Keyboard.up()"}),", and ",(0,t.jsx)(s.a,{href:"/api/puppeteer.keyboard.sendcharacter",children:"Keyboard.sendCharacter()"})," to manually fire events as if they were generated from a real keyboard."]}),(0,t.jsxs)(s.p,{children:["On macOS, keyboard shortcuts like ",(0,t.jsx)(s.code,{children:"\u2318 A"})," -> Select All do not work. See ",(0,t.jsx)(s.a,{href:"https://github.com/puppeteer/puppeteer/issues/1313",children:"#1313"}),"."]}),(0,t.jsxs)(s.p,{children:["The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the ",(0,t.jsx)(s.code,{children:"Keyboard"})," class."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"mouse",children:"mouse"})}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:(0,t.jsx)(s.code,{children:"readonly"})})}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:(0,t.jsx)(s.a,{href:"/api/puppeteer.mouse",children:"Mouse"})})}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport."}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["Every ",(0,t.jsx)(s.code,{children:"page"})," object has its own Mouse, accessible with [",(0,t.jsx)(s.code,{children:"page.mouse"}),"](#pagemouse)."]}),(0,t.jsxs)(s.p,{children:["The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the ",(0,t.jsx)(s.code,{children:"Mouse"})," class."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"touchscreen",children:"touchscreen"})}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:(0,t.jsx)(s.code,{children:"readonly"})})}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:(0,t.jsx)(s.a,{href:"/api/puppeteer.touchscreen",children:"Touchscreen"})})}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:"The Touchscreen class exposes touchscreen events."})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"tracing",children:"tracing"})}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:(0,t.jsx)(s.code,{children:"readonly"})})}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:(0,t.jsx)(s.a,{href:"/api/puppeteer.tracing",children:"Tracing"})})}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"The Tracing class exposes the tracing audit interface."}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["You can use ",(0,t.jsx)(s.code,{children:"tracing.start"})," and ",(0,t.jsx)(s.code,{children:"tracing.stop"})," to create a trace file which can be opened in Chrome DevTools or ",(0,t.jsx)(s.a,{href:"https://chromedevtools.github.io/timeline-viewer/",children:"timeline viewer"}),"."]}),(0,t.jsxs)(s.p,{children:["The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the ",(0,t.jsx)(s.code,{children:"Tracing"})," class."]})]})]})]})]}),"\n",(0,t.jsx)(s.h2,{id:"methods",children:"Methods"}),"\n",(0,t.jsxs)("table",{children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{children:(0,t.jsx)(s.p,{children:"Method"})}),(0,t.jsx)("th",{children:(0,t.jsx)(s.p,{children:"Modifiers"})}),(0,t.jsx)("th",{children:(0,t.jsx)(s.p,{children:"Description"})})]})}),(0,t.jsxs)("tbody",{children:[(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"_",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page._",children:"$(selector)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsxs)(s.p,{children:["Runs ",(0,t.jsx)(s.code,{children:"document.querySelector"})," within the page. If no element matches the selector, the return value resolves to ",(0,t.jsx)(s.code,{children:"null"}),"."]})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"__",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.__",children:"$$(selector)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["The method runs ",(0,t.jsx)(s.code,{children:"document.querySelectorAll"})," within the page. If no elements match the selector, the return value resolves to ",(0,t.jsx)(s.code,{children:"[]"}),"."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["Shortcut for ",(0,t.jsx)(s.a,{href:"/api/puppeteer.frame.__",children:"Page.mainFrame().$$(selector)"}),"."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"__eval",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.__eval",children:"$$eval(selector, pageFunction, args)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["This method runs ",(0,t.jsx)(s.code,{children:"Array.from(document.querySelectorAll(selector))"})," within the page and passes the result as the first argument to the ",(0,t.jsx)(s.code,{children:"pageFunction"}),"."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["If ",(0,t.jsx)(s.code,{children:"pageFunction"})," returns a promise ",(0,t.jsx)(s.code,{children:"$$eval"})," will wait for the promise to resolve and then return its value."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"_eval",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page._eval",children:"$eval(selector, pageFunction, args)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["This method runs ",(0,t.jsx)(s.code,{children:"document.querySelector"})," within the page and passes the result as the first argument to the ",(0,t.jsx)(s.code,{children:"pageFunction"}),"."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["If no element is found matching ",(0,t.jsx)(s.code,{children:"selector"}),", the method will throw an error."]}),(0,t.jsxs)(s.p,{children:["If ",(0,t.jsx)(s.code,{children:"pageFunction"})," returns a promise ",(0,t.jsx)(s.code,{children:"$eval"})," will wait for the promise to resolve and then return its value."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"addscripttag",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.addscripttag",children:"addScriptTag(options)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["Adds a ",(0,t.jsx)(s.code,{children:"<script>"})," tag into the page with the desired URL or content."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["Shortcut for ",(0,t.jsx)(s.a,{href:"/api/puppeteer.frame.addscripttag",children:"page.mainFrame().addScriptTag(options)"}),"."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"addstyletag",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.addstyletag",children:"addStyleTag(options)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["Adds a ",(0,t.jsx)(s.code,{children:'<link rel="stylesheet">'})," tag into the page with the desired URL or a ",(0,t.jsx)(s.code,{children:'<style type="text/css">'})," tag with the content."]}),(0,t.jsxs)(s.p,{children:["Shortcut for ",(0,t.jsx)(s.a,{href:"/api/puppeteer.frame.addstyletag_1",children:"page.mainFrame().addStyleTag(options)"}),"."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"addstyletag",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.addstyletag_1",children:"addStyleTag(options)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"authenticate",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.authenticate",children:"authenticate(credentials)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["Provide credentials for ",(0,t.jsx)(s.code,{children:"HTTP authentication"}),"."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["To disable authentication, pass ",(0,t.jsx)(s.code,{children:"null"}),"."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"bringtofront",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.bringtofront",children:"bringToFront()"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:"Brings page to front (activates tab)."})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"browser",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.browser",children:"browser()"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:"Get the browser the page belongs to."})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"browsercontext",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.browsercontext",children:"browserContext()"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:"Get the browser context that the page belongs to."})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"click",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.click",children:"click(selector, options)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["This method fetches an element with ",(0,t.jsx)(s.code,{children:"selector"}),", scrolls it into view if needed, and then uses ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page#mouse",children:"Page.mouse"})," to click in the center of the element. If there's no element matching ",(0,t.jsx)(s.code,{children:"selector"}),", the method throws an error."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["Bear in mind that if ",(0,t.jsx)(s.code,{children:"click()"})," triggers a navigation event and there's a separate ",(0,t.jsx)(s.code,{children:"page.waitForNavigation()"})," promise to be resolved, you may end up with a race condition that yields unexpected results. The correct pattern for click and wait for navigation is the following:"]}),(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-ts",children:"const [response] = await Promise.all([\n page.waitForNavigation(waitOptions),\n page.click(selector, clickOptions),\n]);\n"})}),(0,t.jsxs)(s.p,{children:["Shortcut for ",(0,t.jsx)(s.a,{href:"/api/puppeteer.frame.click",children:"page.mainFrame().click(selector[, options])"}),"."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"close",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.close",children:"close(options)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"content",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.content",children:"content()"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:"The full HTML contents of the page, including the DOCTYPE."})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"cookies",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.cookies",children:"cookies(urls)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:"If no URLs are specified, this method returns cookies for the current page URL. If URLs are specified, only cookies for those URLs are returned."})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"createcdpsession",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.createcdpsession",children:"createCDPSession()"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:"Creates a Chrome Devtools Protocol session attached to the page."})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"createpdfstream",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.createpdfstream",children:"createPDFStream(options)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["Generates a PDF of the page with the ",(0,t.jsx)(s.code,{children:"print"})," CSS media type."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["To generate a PDF with the ",(0,t.jsx)(s.code,{children:"screen"})," media type, call ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page.emulatemediatype",children:"`page.emulateMediaType('screen')`"})," before calling ",(0,t.jsx)(s.code,{children:"page.pdf()"}),"."]}),(0,t.jsxs)(s.p,{children:["By default, ",(0,t.jsx)(s.code,{children:"page.pdf()"})," generates a pdf with modified colors for printing. Use the ",(0,t.jsx)(s.a,{href:"https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-print-color-adjust",children:"`-webkit-print-color-adjust`"})," property to force rendering of exact colors."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"deletecookie",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.deletecookie",children:"deleteCookie(cookies)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"emulate",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.emulate",children:"emulate(device)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"Emulates a given device's metrics and user agent."}),(0,t.jsxs)(s.p,{children:["To aid emulation, Puppeteer provides a list of known devices that can be via ",(0,t.jsx)(s.a,{href:"/api/puppeteer.knowndevices",children:"KnownDevices"}),"."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["This method is a shortcut for calling two methods: ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setuseragent",children:"Page.setUserAgent()"})," and ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setviewport",children:"Page.setViewport()"}),"."]}),(0,t.jsx)(s.p,{children:"This method will resize the page. A lot of websites don't expect phones to change size, so you should emulate before navigating to the page."})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"emulatecputhrottling",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.emulatecputhrottling",children:"emulateCPUThrottling(factor)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:"Enables CPU throttling to emulate slow CPUs."})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"emulateidlestate",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.emulateidlestate",children:"emulateIdleState(overrides)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:"Emulates the idle state. If no arguments set, clears idle state emulation."})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"emulatemediafeatures",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.emulatemediafeatures",children:"emulateMediaFeatures(features)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"emulatemediatype",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.emulatemediatype",children:"emulateMediaType(type)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"emulatenetworkconditions",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.emulatenetworkconditions",children:"emulateNetworkConditions(networkConditions)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["This does not affect WebSockets and WebRTC PeerConnections (see ",(0,t.jsx)(s.a,{href:"https://crbug.com/563644",children:"https://crbug.com/563644"}),"). To set the page offline, you can use ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setofflinemode",children:"Page.setOfflineMode()"}),"."]}),(0,t.jsxs)(s.p,{children:["A list of predefined network conditions can be used by importing ",(0,t.jsx)(s.a,{href:"/api/puppeteer.predefinednetworkconditions",children:"PredefinedNetworkConditions"}),"."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"emulatetimezone",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.emulatetimezone",children:"emulateTimezone(timezoneId)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"emulatevisiondeficiency",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.emulatevisiondeficiency",children:"emulateVisionDeficiency(type)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:"Simulates the given vision deficiency on the page."})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"evaluate",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.evaluate",children:"evaluate(pageFunction, args)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"Evaluates a function in the page's context and returns the result."}),(0,t.jsxs)(s.p,{children:["If the function passed to ",(0,t.jsx)(s.code,{children:"page.evaluate"})," returns a Promise, the function will wait for the promise to resolve and return its value."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"evaluatehandle",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.evaluatehandle",children:"evaluateHandle(pageFunction, args)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["The only difference between ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page.evaluate",children:"page.evaluate"})," and ",(0,t.jsx)(s.code,{children:"page.evaluateHandle"})," is that ",(0,t.jsx)(s.code,{children:"evaluateHandle"})," will return the value wrapped in an in-page object."]}),(0,t.jsxs)(s.p,{children:["If the function passed to ",(0,t.jsx)(s.code,{children:"page.evaluateHandle"})," returns a Promise, the function will wait for the promise to resolve and return its value."]}),(0,t.jsx)(s.p,{children:"You can pass a string instead of a function (although functions are recommended as they are easier to debug and use with TypeScript):"})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"evaluateonnewdocument",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.evaluateonnewdocument",children:"evaluateOnNewDocument(pageFunction, args)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"Adds a function which would be invoked in one of the following scenarios:"}),(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsx)(s.p,{children:"whenever the page is navigated"}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsx)(s.p,{children:"whenever the child frame is attached or navigated. In this case, the function is invoked in the context of the newly attached frame."}),"\n"]}),"\n"]}),(0,t.jsxs)(s.p,{children:["The function is invoked after the document was created but before any of its scripts were run. This is useful to amend the JavaScript environment, e.g. to seed ",(0,t.jsx)(s.code,{children:"Math.random"}),"."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"exposefunction",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.exposefunction",children:"exposeFunction(name, pptrFunction)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["The method adds a function called ",(0,t.jsx)(s.code,{children:"name"})," on the page's ",(0,t.jsx)(s.code,{children:"window"})," object. When called, the function executes ",(0,t.jsx)(s.code,{children:"puppeteerFunction"})," in node.js and returns a ",(0,t.jsx)(s.code,{children:"Promise"})," which resolves to the return value of ",(0,t.jsx)(s.code,{children:"puppeteerFunction"}),"."]}),(0,t.jsxs)(s.p,{children:["If the puppeteerFunction returns a ",(0,t.jsx)(s.code,{children:"Promise"}),", it will be awaited."]}),(0,t.jsx)(s.admonition,{type:"note",children:(0,t.jsxs)(s.p,{children:["Functions installed via ",(0,t.jsx)(s.code,{children:"page.exposeFunction"})," survive navigations."]})})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"focus",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.focus",children:"focus(selector)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["This method fetches an element with ",(0,t.jsx)(s.code,{children:"selector"})," and focuses it. If there's no element matching ",(0,t.jsx)(s.code,{children:"selector"}),", the method throws an error."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["Shortcut for ",(0,t.jsx)(s.a,{href:"/api/puppeteer.frame.focus",children:"page.mainFrame().focus(selector)"}),"."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"frames",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.frames",children:"frames()"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:"An array of all frames attached to the page."})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"getdefaulttimeout",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.getdefaulttimeout",children:"getDefaultTimeout()"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:"Maximum time in milliseconds."})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"goback",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.goback",children:"goBack(options)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"This method navigate to the previous page in history."}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["The argument ",(0,t.jsx)(s.code,{children:"options"})," might have the following properties:"]}),(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"timeout"})," : Maximum navigation time in milliseconds, defaults to 30 seconds, pass 0 to disable timeout. The default value can be changed by using the ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setdefaultnavigationtimeout",children:"Page.setDefaultNavigationTimeout()"})," or ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setdefaulttimeout",children:"Page.setDefaultTimeout()"})," methods."]}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"waitUntil"})," : When to consider navigation succeeded, defaults to ",(0,t.jsx)(s.code,{children:"load"}),". Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either:",(0,t.jsx)("br",{})," - ",(0,t.jsx)(s.code,{children:"load"})," : consider navigation to be finished when the load event is fired.",(0,t.jsx)("br",{})," - ",(0,t.jsx)(s.code,{children:"domcontentloaded"})," : consider navigation to be finished when the DOMContentLoaded event is fired.",(0,t.jsx)("br",{})," - ",(0,t.jsx)(s.code,{children:"networkidle0"})," : consider navigation to be finished when there are no more than 0 network connections for at least ",(0,t.jsx)(s.code,{children:"500"})," ms.",(0,t.jsx)("br",{})," - ",(0,t.jsx)(s.code,{children:"networkidle2"})," : consider navigation to be finished when there are no more than 2 network connections for at least ",(0,t.jsx)(s.code,{children:"500"})," ms."]}),"\n"]}),"\n"]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"goforward",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.goforward",children:"goForward(options)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"This method navigate to the next page in history."}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["The argument ",(0,t.jsx)(s.code,{children:"options"})," might have the following properties:"]}),(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"timeout"})," : Maximum navigation time in milliseconds, defaults to 30 seconds, pass 0 to disable timeout. The default value can be changed by using the ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setdefaultnavigationtimeout",children:"Page.setDefaultNavigationTimeout()"})," or ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setdefaulttimeout",children:"Page.setDefaultTimeout()"})," methods."]}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"waitUntil"}),": When to consider navigation succeeded, defaults to ",(0,t.jsx)(s.code,{children:"load"}),". Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either:",(0,t.jsx)("br",{})," - ",(0,t.jsx)(s.code,{children:"load"})," : consider navigation to be finished when the load event is fired.",(0,t.jsx)("br",{})," - ",(0,t.jsx)(s.code,{children:"domcontentloaded"})," : consider navigation to be finished when the DOMContentLoaded event is fired.",(0,t.jsx)("br",{})," - ",(0,t.jsx)(s.code,{children:"networkidle0"})," : consider navigation to be finished when there are no more than 0 network connections for at least ",(0,t.jsx)(s.code,{children:"500"})," ms.",(0,t.jsx)("br",{})," - ",(0,t.jsx)(s.code,{children:"networkidle2"})," : consider navigation to be finished when there are no more than 2 network connections for at least ",(0,t.jsx)(s.code,{children:"500"})," ms."]}),"\n"]}),"\n"]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"goto",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.goto",children:"goto(url, options)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["Navigates the page to the given ",(0,t.jsx)(s.code,{children:"url"}),"."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["Navigation to ",(0,t.jsx)(s.code,{children:"about:blank"})," or navigation to the same URL with a different hash will succeed and return ",(0,t.jsx)(s.code,{children:"null"}),"."]}),(0,t.jsx)(s.admonition,{type:"warning",children:(0,t.jsxs)(s.p,{children:["Headless mode doesn't support navigation to a PDF document. See the ",(0,t.jsx)(s.a,{href:"https://bugs.chromium.org/p/chromium/issues/detail?id=761295",children:"upstream issue"}),"."]})}),(0,t.jsxs)(s.p,{children:["Shortcut for ",(0,t.jsx)(s.a,{href:"/api/puppeteer.frame.goto",children:"page.mainFrame().goto(url, options)"}),"."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"hover",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.hover",children:"hover(selector)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["This method fetches an element with ",(0,t.jsx)(s.code,{children:"selector"}),", scrolls it into view if needed, and then uses ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page#mouse",children:"Page.mouse"})," to hover over the center of the element. If there's no element matching ",(0,t.jsx)(s.code,{children:"selector"}),", the method throws an error."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["Shortcut for ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page.hover",children:"page.mainFrame().hover(selector)"}),"."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"isclosed",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.isclosed",children:"isClosed()"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:"Indicates that the page has been closed."})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"isdraginterceptionenabled",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.isdraginterceptionenabled",children:"isDragInterceptionEnabled()"})})}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:(0,t.jsx)(s.code,{children:"deprecated"})})}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"true"})," if drag events are being intercepted, ",(0,t.jsx)(s.code,{children:"false"})," otherwise."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Deprecated:"})}),(0,t.jsxs)(s.p,{children:["We no longer support intercepting drag payloads. Use the new drag APIs found on ",(0,t.jsx)(s.a,{href:"/api/puppeteer.elementhandle",children:"ElementHandle"})," to drag (or just use the ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page#mouse",children:"Page.mouse"}),")."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"isjavascriptenabled",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.isjavascriptenabled",children:"isJavaScriptEnabled()"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"true"})," if the page has JavaScript enabled, ",(0,t.jsx)(s.code,{children:"false"})," otherwise."]})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"isserviceworkerbypassed",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.isserviceworkerbypassed",children:"isServiceWorkerBypassed()"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"true"})," if the service worker are being bypassed, ",(0,t.jsx)(s.code,{children:"false"})," otherwise."]})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"locator",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.locator",children:"locator(selector)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["Creates a locator for the provided selector. See ",(0,t.jsx)(s.a,{href:"/api/puppeteer.locator",children:"Locator"})," for details and supported actions."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsx)(s.p,{children:"Locators API is experimental and we will not follow semver for breaking change in the Locators API."})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"locator",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.locator_1",children:"locator(func)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["Creates a locator for the provided function. See ",(0,t.jsx)(s.a,{href:"/api/puppeteer.locator",children:"Locator"})," for details and supported actions."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsx)(s.p,{children:"Locators API is experimental and we will not follow semver for breaking change in the Locators API."})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"mainframe",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.mainframe",children:"mainFrame()"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"The page's main frame."}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsx)(s.p,{children:"Page is guaranteed to have a main frame which persists during navigations."})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"metrics",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.metrics",children:"metrics()"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"Object containing metrics as key/value pairs."}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsx)(s.p,{children:"All timestamps are in monotonic time: monotonically increasing time in seconds since an arbitrary point in the past."})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"pdf",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.pdf",children:"pdf(options)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["Generates a PDF of the page with the ",(0,t.jsx)(s.code,{children:"print"})," CSS media type."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["To generate a PDF with the ",(0,t.jsx)(s.code,{children:"screen"})," media type, call ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page.emulatemediatype",children:"`page.emulateMediaType('screen')`"})," before calling ",(0,t.jsx)(s.code,{children:"page.pdf()"}),"."]}),(0,t.jsxs)(s.p,{children:["By default, ",(0,t.jsx)(s.code,{children:"page.pdf()"})," generates a pdf with modified colors for printing. Use the ",(0,t.jsx)(s.a,{href:"https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-print-color-adjust",children:"`-webkit-print-color-adjust`"})," property to force rendering of exact colors."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"queryobjects",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.queryobjects",children:"queryObjects(prototypeHandle)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:"This method iterates the JavaScript heap and finds all objects with the given prototype."})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"reload",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.reload",children:"reload(options)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:"Reloads the page."})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"removeexposedfunction",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.removeexposedfunction",children:"removeExposedFunction(name)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsxs)(s.p,{children:["The method removes a previously added function via $",(0,t.jsx)(s.a,{href:"/api/puppeteer.page.exposefunction",children:"Page.exposeFunction()"})," called ",(0,t.jsx)(s.code,{children:"name"})," from the page's ",(0,t.jsx)(s.code,{children:"window"})," object."]})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"removescripttoevaluateonnewdocument",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.removescripttoevaluateonnewdocument",children:"removeScriptToEvaluateOnNewDocument(identifier)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:"Removes script that injected into page by Page.evaluateOnNewDocument."})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"screencast",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.screencast",children:"screencast(options)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.strong,{children:(0,t.jsx)(s.em,{children:"(Experimental)"})})," Captures a screencast of this ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page",children:"page"}),"."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["All recordings will be ",(0,t.jsx)(s.a,{href:"https://www.webmproject.org/",children:"WebM"})," format using the ",(0,t.jsx)(s.a,{href:"https://www.webmproject.org/vp9/",children:"VP9"})," video codec. The FPS is 30."]}),(0,t.jsxs)(s.p,{children:["You must have ",(0,t.jsx)(s.a,{href:"https://ffmpeg.org/",children:"ffmpeg"})," installed on your system."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"screenshot",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.screenshot",children:"screenshot(options)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsxs)(s.p,{children:["Captures a screenshot of this ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page",children:"page"}),"."]})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"screenshot",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.screenshot_1",children:"screenshot(options)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"select",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.select",children:"select(selector, values)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["Triggers a ",(0,t.jsx)(s.code,{children:"change"})," and ",(0,t.jsx)(s.code,{children:"input"})," event once all the provided options have been selected. If there's no ",(0,t.jsx)(s.code,{children:"<select>"})," element matching ",(0,t.jsx)(s.code,{children:"selector"}),", the method throws an error."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["Shortcut for ",(0,t.jsx)(s.a,{href:"/api/puppeteer.frame.select",children:"page.mainFrame().select()"})]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"setbypasscsp",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setbypasscsp",children:"setBypassCSP(enabled)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"Toggles bypassing page's Content-Security-Policy."}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["NOTE: CSP bypassing happens at the moment of CSP initialization rather than evaluation. Usually, this means that ",(0,t.jsx)(s.code,{children:"page.setBypassCSP"})," should be called before navigating to the domain."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"setbypassserviceworker",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setbypassserviceworker",children:"setBypassServiceWorker(bypass)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:"Toggles ignoring of service worker for each request."})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"setcacheenabled",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setcacheenabled",children:"setCacheEnabled(enabled)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:"Toggles ignoring cache for each request based on the enabled state. By default, caching is enabled."})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"setcontent",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setcontent",children:"setContent(html, options)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"Set the content of the page."}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["The parameter ",(0,t.jsx)(s.code,{children:"options"})," might have the following options."]}),(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"timeout"})," : Maximum time in milliseconds for resources to load, defaults to 30 seconds, pass ",(0,t.jsx)(s.code,{children:"0"})," to disable timeout. The default value can be changed by using the ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setdefaultnavigationtimeout",children:"Page.setDefaultNavigationTimeout()"})," or ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setdefaulttimeout",children:"Page.setDefaultTimeout()"})," methods."]}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"waitUntil"}),": When to consider setting markup succeeded, defaults to ",(0,t.jsx)(s.code,{children:"load"}),". Given an array of event strings, setting content is considered to be successful after all events have been fired. Events can be either:",(0,t.jsx)("br",{})," - ",(0,t.jsx)(s.code,{children:"load"})," : consider setting content to be finished when the ",(0,t.jsx)(s.code,{children:"load"})," event is fired.",(0,t.jsx)("br",{})," - ",(0,t.jsx)(s.code,{children:"domcontentloaded"})," : consider setting content to be finished when the ",(0,t.jsx)(s.code,{children:"DOMContentLoaded"})," event is fired.",(0,t.jsx)("br",{})," - ",(0,t.jsx)(s.code,{children:"networkidle0"})," : consider setting content to be finished when there are no more than 0 network connections for at least ",(0,t.jsx)(s.code,{children:"500"})," ms.",(0,t.jsx)("br",{})," - ",(0,t.jsx)(s.code,{children:"networkidle2"})," : consider setting content to be finished when there are no more than 2 network connections for at least ",(0,t.jsx)(s.code,{children:"500"})," ms."]}),"\n"]}),"\n"]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"setcookie",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setcookie",children:"setCookie(cookies)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"setdefaultnavigationtimeout",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setdefaultnavigationtimeout",children:"setDefaultNavigationTimeout(timeout)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"This setting will change the default maximum navigation time for the following methods and related shortcuts:"}),(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsx)(s.p,{children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.goback",children:"page.goBack(options)"})}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsx)(s.p,{children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.goforward",children:"page.goForward(options)"})}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsx)(s.p,{children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.goto",children:"page.goto(url,options)"})}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsx)(s.p,{children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.reload",children:"page.reload(options)"})}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsx)(s.p,{children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setcontent",children:"page.setContent(html,options)"})}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsx)(s.p,{children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.waitfornavigation",children:"page.waitForNavigation(options)"})}),"\n"]}),"\n"]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"setdefaulttimeout",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setdefaulttimeout",children:"setDefaultTimeout(timeout)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"setdraginterception",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setdraginterception",children:"setDragInterception(enabled)"})})}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:(0,t.jsx)(s.code,{children:"deprecated"})})}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Deprecated:"})}),(0,t.jsxs)(s.p,{children:["We no longer support intercepting drag payloads. Use the new drag APIs found on ",(0,t.jsx)(s.a,{href:"/api/puppeteer.elementhandle",children:"ElementHandle"})," to drag (or just use the ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page#mouse",children:"Page.mouse"}),")."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"setextrahttpheaders",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setextrahttpheaders",children:"setExtraHTTPHeaders(headers)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"The extra HTTP headers will be sent with every request the page initiates."}),(0,t.jsx)(s.admonition,{type:"tip",children:(0,t.jsx)(s.p,{children:"All HTTP header names are lowercased. (HTTP headers are case-insensitive, so this shouldn\u2019t impact your server code.)"})}),(0,t.jsx)(s.admonition,{type:"note",children:(0,t.jsx)(s.p,{children:"page.setExtraHTTPHeaders does not guarantee the order of headers in the outgoing requests."})})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"setgeolocation",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setgeolocation",children:"setGeolocation(options)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"Sets the page's geolocation."}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["Consider using ",(0,t.jsx)(s.a,{href:"/api/puppeteer.browsercontext.overridepermissions",children:"BrowserContext.overridePermissions()"})," to grant permissions for the page to read its geolocation."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"setjavascriptenabled",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setjavascriptenabled",children:"setJavaScriptEnabled(enabled)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsx)(s.p,{children:"NOTE: changing this value won't affect scripts that have already been run. It will take full effect on the next navigation."})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"setofflinemode",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setofflinemode",children:"setOfflineMode(enabled)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"Sets the network connection to offline."}),(0,t.jsxs)(s.p,{children:["It does not change the parameters used in ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page.emulatenetworkconditions",children:"Page.emulateNetworkConditions()"})]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"setrequestinterception",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setrequestinterception",children:"setRequestInterception(value)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["Activating request interception enables ",(0,t.jsx)(s.a,{href:"/api/puppeteer.httprequest.abort",children:"HTTPRequest.abort()"}),", ",(0,t.jsx)(s.a,{href:"/api/puppeteer.httprequest.continue",children:"HTTPRequest.continue()"})," and ",(0,t.jsx)(s.a,{href:"/api/puppeteer.httprequest.respond",children:"HTTPRequest.respond()"})," methods. This provides the capability to modify network requests that are made by a page."]}),(0,t.jsx)(s.p,{children:"Once request interception is enabled, every request will stall unless it's continued, responded or aborted; or completed using the browser cache."}),(0,t.jsxs)(s.p,{children:["See the ",(0,t.jsx)(s.a,{href:"https://pptr.dev/guides/network-interception",children:"Request interception guide"})," for more details."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"setuseragent",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setuseragent",children:"setUserAgent(userAgent, userAgentMetadata)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"setviewport",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setviewport",children:"setViewport(viewport)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"page.setViewport"})," will resize the page. A lot of websites don't expect phones to change size, so you should set the viewport before navigating to the page."]}),(0,t.jsx)(s.p,{children:"In the case of multiple pages in a single browser, each page can have its own viewport size."}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsx)(s.p,{children:"NOTE: in certain cases, setting viewport will reload the page in order to set the isMobile or hasTouch properties."})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"tap",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.tap",children:"tap(selector)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["This method fetches an element with ",(0,t.jsx)(s.code,{children:"selector"}),", scrolls it into view if needed, and then uses ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page#touchscreen",children:"Page.touchscreen"})," to tap in the center of the element. If there's no element matching ",(0,t.jsx)(s.code,{children:"selector"}),", the method throws an error."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["Shortcut for ",(0,t.jsx)(s.a,{href:"/api/puppeteer.frame.tap",children:"page.mainFrame().tap(selector)"}),"."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"target",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.target",children:"target()"})})}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:(0,t.jsx)(s.code,{children:"deprecated"})})}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"A target this page was created from."}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Deprecated:"})}),(0,t.jsxs)(s.p,{children:["Use ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page.createcdpsession",children:"Page.createCDPSession()"})," directly."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"title",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.title",children:"title()"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"The page's title"}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["Shortcut for ",(0,t.jsx)(s.a,{href:"/api/puppeteer.frame.title",children:"page.mainFrame().title()"}),"."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"type",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.type",children:"type(selector, text, options)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["Sends a ",(0,t.jsx)(s.code,{children:"keydown"}),", ",(0,t.jsx)(s.code,{children:"keypress/input"}),", and ",(0,t.jsx)(s.code,{children:"keyup"})," event for each character in the text."]}),(0,t.jsxs)(s.p,{children:["To press a special key, like ",(0,t.jsx)(s.code,{children:"Control"})," or ",(0,t.jsx)(s.code,{children:"ArrowDown"}),", use ",(0,t.jsx)(s.a,{href:"/api/puppeteer.keyboard.press",children:"Keyboard.press()"}),"."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"url",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.url",children:"url()"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"The page's URL."}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["Shortcut for ",(0,t.jsx)(s.a,{href:"/api/puppeteer.frame.url",children:"page.mainFrame().url()"}),"."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"viewport",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.viewport",children:"viewport()"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"Returns the current page viewport settings without checking the actual page viewport."}),(0,t.jsxs)(s.p,{children:["This is either the viewport set with the previous ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setviewport",children:"Page.setViewport()"})," call or the default viewport set via ",(0,t.jsx)(s.a,{href:"/api/puppeteer.browserconnectoptions#defaultviewport",children:"BrowserConnectOptions.defaultViewport"}),"."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"waitfordeviceprompt",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.waitfordeviceprompt",children:"waitForDevicePrompt(options)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"This method is typically coupled with an action that triggers a device request from an api such as WebBluetooth."}),(0,t.jsx)(s.admonition,{type:"caution",children:(0,t.jsx)(s.p,{children:"This must be called before the device request is made. It will not return a currently active device prompt."})})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"waitforfilechooser",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.waitforfilechooser",children:"waitForFileChooser(options)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"This method is typically coupled with an action that triggers file choosing."}),(0,t.jsx)(s.admonition,{type:"caution",children:(0,t.jsx)(s.p,{children:"This must be called before the file chooser is launched. It will not return a currently active file chooser."})}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:['In the "headful" browser, this method results in the native file picker dialog ',(0,t.jsx)(s.code,{children:"not showing up"})," for the user."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"waitforframe",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.waitforframe",children:"waitForFrame(urlOrPredicate, options)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:"Waits for a frame matching the given conditions to appear."})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"waitforfunction",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.waitforfunction",children:"waitForFunction(pageFunction, options, args)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsxs)(s.p,{children:["Waits for the provided function, ",(0,t.jsx)(s.code,{children:"pageFunction"}),", to return a truthy value when evaluated in the page's context."]})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"waitfornavigation",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.waitfornavigation",children:"waitForNavigation(options)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:"Waits for the page to navigate to a new URL or to reload. It is useful when you run code that will indirectly cause the page to navigate."}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["Usage of the ",(0,t.jsx)(s.a,{href:"https://developer.mozilla.org/en-US/docs/Web/API/History_API",children:"History API"})," to change the URL is considered a navigation."]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"waitfornetworkidle",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.waitfornetworkidle",children:"waitForNetworkIdle(options)"})})}),(0,t.jsx)("td",{}),(0,t.jsx)("td",{children:(0,t.jsx)(s.p,{children:"Waits for the network to be idle."})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"waitforrequest",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.waitforrequest",children:"waitForRequest(urlOrPredicate, options)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsx)(s.p,{children:"Optional Waiting Parameters have:"}),(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:[(0,t.jsx)(s.code,{children:"timeout"}),": Maximum wait time in milliseconds, defaults to ",(0,t.jsx)(s.code,{children:"30"})," seconds, pass ",(0,t.jsx)(s.code,{children:"0"})," to disable the timeout. The default value can be changed by using the ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setdefaulttimeout",children:"Page.setDefaultTimeout()"})," method."]}),"\n"]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"waitforresponse",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.waitforresponse",children:"waitForResponse(urlOrPredicate, options)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsx)(s.p,{children:"Optional Parameter have:"}),(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:[(0,t.jsx)(s.code,{children:"timeout"}),": Maximum wait time in milliseconds, defaults to ",(0,t.jsx)(s.code,{children:"30"})," seconds, pass ",(0,t.jsx)(s.code,{children:"0"})," to disable the timeout. The default value can be changed by using the ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setdefaulttimeout",children:"Page.setDefaultTimeout()"})," method."]}),"\n"]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"waitforselector",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.waitforselector",children:"waitForSelector(selector, options)"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["Wait for the ",(0,t.jsx)(s.code,{children:"selector"})," to appear in page. If at the moment of calling the method the ",(0,t.jsx)(s.code,{children:"selector"})," already exists, the method will return immediately. If the ",(0,t.jsx)(s.code,{children:"selector"})," doesn't appear after the ",(0,t.jsx)(s.code,{children:"timeout"})," milliseconds of waiting, the function will throw."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsxs)(s.p,{children:["The optional Parameter in Arguments ",(0,t.jsx)(s.code,{children:"options"})," are:"]}),(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"visible"}),": A boolean wait for element to be present in DOM and to be visible, i.e. to not have ",(0,t.jsx)(s.code,{children:"display: none"})," or ",(0,t.jsx)(s.code,{children:"visibility: hidden"})," CSS properties. Defaults to ",(0,t.jsx)(s.code,{children:"false"}),"."]}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"hidden"}),": Wait for element to not be found in the DOM or to be hidden, i.e. have ",(0,t.jsx)(s.code,{children:"display: none"})," or ",(0,t.jsx)(s.code,{children:"visibility: hidden"})," CSS properties. Defaults to ",(0,t.jsx)(s.code,{children:"false"}),"."]}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"timeout"}),": maximum time to wait for in milliseconds. Defaults to ",(0,t.jsx)(s.code,{children:"30000"})," (30 seconds). Pass ",(0,t.jsx)(s.code,{children:"0"})," to disable timeout. The default value can be changed by using the ",(0,t.jsx)(s.a,{href:"/api/puppeteer.page.setdefaulttimeout",children:"Page.setDefaultTimeout()"})," method."]}),"\n"]}),"\n"]})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsx)("span",{id:"workers",children:(0,t.jsx)(s.a,{href:"/api/puppeteer.page.workers",children:"workers()"})})}),(0,t.jsx)("td",{}),(0,t.jsxs)("td",{children:[(0,t.jsxs)(s.p,{children:["All of the dedicated ",(0,t.jsx)(s.a,{href:"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API",children:"WebWorkers"})," associated with the page."]}),(0,t.jsx)(s.p,{children:(0,t.jsx)(s.strong,{children:"Remarks:"})}),(0,t.jsx)(s.p,{children:"This does not contain ServiceWorkers"})]})]})]})]})]})}function o(e={}){const{wrapper:s}={...(0,i.a)(),...e.components};return s?(0,t.jsx)(s,{...e,children:(0,t.jsx)(h,{...e})}):h(e)}},75251:(e,s,r)=>{var t=r(67294),i=Symbol.for("react.element"),n=Symbol.for("react.fragment"),d=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(e,s,r){var t,n={},l=null,h=null;for(t in void 0!==r&&(l=""+r),void 0!==s.key&&(l=""+s.key),void 0!==s.ref&&(h=s.ref),s)d.call(s,t)&&!c.hasOwnProperty(t)&&(n[t]=s[t]);if(e&&e.defaultProps)for(t in s=e.defaultProps)void 0===n[t]&&(n[t]=s[t]);return{$$typeof:i,type:e,key:l,ref:h,props:n,_owner:a.current}}s.Fragment=n,s.jsx=l,s.jsxs=l},85893:(e,s,r)=>{e.exports=r(75251)},11151:(e,s,r)=>{r.d(s,{Z:()=>a,a:()=>d});var t=r(67294);const i={},n=t.createContext(i);function d(e){const s=t.useContext(n);return t.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:d(e.components),t.createElement(n.Provider,{value:s},e.children)}}}]);