puppeteer/assets/js/5eb2eb1f.ae1aff79.js
release-please[bot] 5878dff7cb deploy: 03e10a7559
2024-06-11 09:40:10 +00:00

2 lines
22 KiB
JavaScript

/*! For license information please see 5eb2eb1f.ae1aff79.js.LICENSE.txt */
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[18765],{62818:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>a,default:()=>p,frontMatter:()=>i,metadata:()=>d,toc:()=>c});var s=t(85893),n=t(11151);const i={sidebar_label:"Frame"},a="Frame class",d={id:"api/puppeteer.frame",title:"Frame class",description:"Represents a DOM frame.",source:"@site/../docs/api/puppeteer.frame.md",sourceDirName:"api",slug:"/api/puppeteer.frame",permalink:"/next/api/puppeteer.frame",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{sidebar_label:"Frame"},sidebar:"api",previous:{title:"ConsoleMessage.type",permalink:"/next/api/puppeteer.consolemessage.type"},next:{title:"Frame.$",permalink:"/next/api/puppeteer.frame._"}},l={},c=[{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:"Example 3",id:"example-3",level:2},{value:"Properties",id:"properties",level:2},{value:"Methods",id:"methods",level:2}];function h(e){const r={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h4:"h4",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,n.a)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.h1,{id:"frame-class",children:"Frame class"}),"\n",(0,s.jsx)(r.p,{children:"Represents a DOM frame."}),"\n",(0,s.jsxs)(r.p,{children:["To understand frames, you can think of frames as ",(0,s.jsx)(r.code,{children:"<iframe>"})," elements. Just like iframes, frames can be nested, and when JavaScript is executed in a frame, the JavaScript does not effect frames inside the ambient frame the JavaScript executes in."]}),"\n",(0,s.jsx)(r.h4,{id:"signature",children:"Signature:"}),"\n",(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-typescript",children:"export declare abstract class Frame extends EventEmitter<FrameEvents>\n"})}),"\n",(0,s.jsxs)(r.p,{children:[(0,s.jsx)(r.strong,{children:"Extends:"})," ",(0,s.jsx)(r.a,{href:"/next/api/puppeteer.eventemitter",children:"EventEmitter"}),"<",(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frameevents",children:"FrameEvents"}),">"]}),"\n",(0,s.jsx)(r.h2,{id:"remarks",children:"Remarks"}),"\n",(0,s.jsxs)(r.p,{children:["Frame lifecycles are controlled by three events that are all dispatched on the parent ",(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.page",children:"page"}),":"]}),"\n",(0,s.jsxs)(r.ul,{children:["\n",(0,s.jsxs)(r.li,{children:[(0,s.jsx)(r.a,{href:"/next/api/puppeteer.pageevent",children:"PageEvent.FrameAttached"})," - ",(0,s.jsx)(r.a,{href:"/next/api/puppeteer.pageevent",children:"PageEvent.FrameNavigated"})," - ",(0,s.jsx)(r.a,{href:"/next/api/puppeteer.pageevent",children:"PageEvent.FrameDetached"})]}),"\n"]}),"\n",(0,s.jsxs)(r.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,s.jsx)(r.code,{children:"Frame"})," class."]}),"\n",(0,s.jsx)(r.h2,{id:"example-1",children:"Example 1"}),"\n",(0,s.jsxs)(r.p,{children:["At any point in time, ",(0,s.jsx)(r.a,{href:"/next/api/puppeteer.page",children:"pages"})," expose their current frame tree via the ",(0,s.jsx)(r.a,{href:"/next/api/puppeteer.page.mainframe",children:"Page.mainFrame()"})," and ",(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.childframes",children:"Frame.childFrames()"})," methods."]}),"\n",(0,s.jsx)(r.h2,{id:"example-2",children:"Example 2"}),"\n",(0,s.jsx)(r.p,{children:"An example of dumping frame tree:"}),"\n",(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.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://www.google.com/chrome/browser/canary.html');\n dumpFrameTree(page.mainFrame(), '');\n await browser.close();\n\n function dumpFrameTree(frame, indent) {\n console.log(indent + frame.url());\n for (const child of frame.childFrames()) {\n dumpFrameTree(child, indent + ' ');\n }\n }\n})();\n"})}),"\n",(0,s.jsx)(r.h2,{id:"example-3",children:"Example 3"}),"\n",(0,s.jsx)(r.p,{children:"An example of getting text from an iframe element:"}),"\n",(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-ts",children:"const frame = page.frames().find(frame => frame.name() === 'myframe');\nconst text = await frame.$eval('.selector', element => element.textContent);\nconsole.log(text);\n"})}),"\n",(0,s.jsx)(r.h2,{id:"properties",children:"Properties"}),"\n",(0,s.jsxs)("table",{children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:(0,s.jsx)(r.p,{children:"Property"})}),(0,s.jsx)("th",{children:(0,s.jsx)(r.p,{children:"Modifiers"})}),(0,s.jsx)("th",{children:(0,s.jsx)(r.p,{children:"Type"})}),(0,s.jsx)("th",{children:(0,s.jsx)(r.p,{children:"Description"})})]})}),(0,s.jsx)("tbody",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"detached",children:"detached"})}),(0,s.jsx)("td",{children:(0,s.jsx)(r.p,{children:(0,s.jsx)(r.code,{children:"readonly"})})}),(0,s.jsx)("td",{children:(0,s.jsx)(r.p,{children:"boolean"})}),(0,s.jsx)("td",{})]})})]}),"\n",(0,s.jsx)(r.h2,{id:"methods",children:"Methods"}),"\n",(0,s.jsxs)("table",{children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:(0,s.jsx)(r.p,{children:"Method"})}),(0,s.jsx)("th",{children:(0,s.jsx)(r.p,{children:"Modifiers"})}),(0,s.jsx)("th",{children:(0,s.jsx)(r.p,{children:"Description"})})]})}),(0,s.jsxs)("tbody",{children:[(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"_",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame._",children:"$(selector)"})})}),(0,s.jsx)("td",{}),(0,s.jsx)("td",{children:(0,s.jsx)(r.p,{children:"Queries the frame for an element matching the given selector."})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"__",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.__",children:"$$(selector, options)"})})}),(0,s.jsx)("td",{}),(0,s.jsx)("td",{children:(0,s.jsx)(r.p,{children:"Queries the frame for all elements matching the given selector."})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"__eval",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.__eval",children:"$$eval(selector, pageFunction, args)"})})}),(0,s.jsx)("td",{}),(0,s.jsxs)("td",{children:[(0,s.jsx)(r.p,{children:"Runs the given function on an array of elements matching the given selector in the frame."}),(0,s.jsx)(r.p,{children:"If the given function returns a promise, then this method will wait till the promise resolves."})]})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"_eval",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame._eval",children:"$eval(selector, pageFunction, args)"})})}),(0,s.jsx)("td",{}),(0,s.jsxs)("td",{children:[(0,s.jsx)(r.p,{children:"Runs the given function on the first element matching the given selector in the frame."}),(0,s.jsx)(r.p,{children:"If the given function returns a promise, then this method will wait till the promise resolves."})]})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"addscripttag",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.addscripttag",children:"addScriptTag(options)"})})}),(0,s.jsx)("td",{}),(0,s.jsx)("td",{children:(0,s.jsxs)(r.p,{children:["Adds a ",(0,s.jsx)(r.code,{children:"<script>"})," tag into the page with the desired url or content."]})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"addstyletag",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.addstyletag",children:"addStyleTag(options)"})})}),(0,s.jsx)("td",{}),(0,s.jsx)("td",{children:(0,s.jsxs)(r.p,{children:["Adds a ",(0,s.jsx)(r.code,{children:"HTMLStyleElement"})," into the frame with the desired URL"]})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"addstyletag",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.addstyletag_1",children:"addStyleTag(options)"})})}),(0,s.jsx)("td",{}),(0,s.jsx)("td",{children:(0,s.jsxs)(r.p,{children:["Adds a ",(0,s.jsx)(r.code,{children:"HTMLLinkElement"})," into the frame with the desired URL"]})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"childframes",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.childframes",children:"childFrames()"})})}),(0,s.jsx)("td",{}),(0,s.jsx)("td",{children:(0,s.jsx)(r.p,{children:"An array of child frames."})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"click",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.click",children:"click(selector, options)"})})}),(0,s.jsx)("td",{}),(0,s.jsxs)("td",{children:[(0,s.jsxs)(r.p,{children:["Clicks the first element found that matches ",(0,s.jsx)(r.code,{children:"selector"}),"."]}),(0,s.jsx)(r.p,{children:(0,s.jsx)(r.strong,{children:"Remarks:"})}),(0,s.jsxs)(r.p,{children:["If ",(0,s.jsx)(r.code,{children:"click()"})," triggers a navigation event and there's a separate ",(0,s.jsx)(r.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,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-ts",children:"const [response] = await Promise.all([\n page.waitForNavigation(waitOptions),\n frame.click(selector, clickOptions),\n]);\n"})})]})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"content",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.content",children:"content()"})})}),(0,s.jsx)("td",{}),(0,s.jsx)("td",{children:(0,s.jsx)(r.p,{children:"The full HTML contents of the frame, including the DOCTYPE."})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"evaluate",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.evaluate",children:"evaluate(pageFunction, args)"})})}),(0,s.jsx)("td",{}),(0,s.jsx)("td",{children:(0,s.jsxs)(r.p,{children:["Behaves identically to ",(0,s.jsx)(r.a,{href:"/next/api/puppeteer.page.evaluate",children:"Page.evaluate()"})," except it's run within the context of this frame."]})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"evaluatehandle",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.evaluatehandle",children:"evaluateHandle(pageFunction, args)"})})}),(0,s.jsx)("td",{}),(0,s.jsx)("td",{children:(0,s.jsxs)(r.p,{children:["Behaves identically to ",(0,s.jsx)(r.a,{href:"/next/api/puppeteer.page.evaluatehandle",children:"Page.evaluateHandle()"})," except it's run within the context of this frame."]})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"focus",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.focus",children:"focus(selector)"})})}),(0,s.jsx)("td",{}),(0,s.jsx)("td",{children:(0,s.jsxs)(r.p,{children:["Focuses the first element that matches the ",(0,s.jsx)(r.code,{children:"selector"}),"."]})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"frameelement",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.frameelement",children:"frameElement()"})})}),(0,s.jsx)("td",{}),(0,s.jsx)("td",{})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"goto",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.goto",children:"goto(url, options)"})})}),(0,s.jsx)("td",{}),(0,s.jsxs)("td",{children:[(0,s.jsxs)(r.p,{children:["Navigates the frame or page to the given ",(0,s.jsx)(r.code,{children:"url"}),"."]}),(0,s.jsx)(r.p,{children:(0,s.jsx)(r.strong,{children:"Remarks:"})}),(0,s.jsxs)(r.p,{children:["Navigation to ",(0,s.jsx)(r.code,{children:"about:blank"})," or navigation to the same URL with a different hash will succeed and return ",(0,s.jsx)(r.code,{children:"null"}),"."]}),(0,s.jsx)(r.admonition,{type:"warning",children:(0,s.jsxs)(r.p,{children:["Headless shell mode doesn't support navigation to a PDF document. See the ",(0,s.jsx)(r.a,{href:"https://crbug.com/761295",children:"upstream issue"}),"."]})}),(0,s.jsxs)(r.p,{children:['In headless shell, this method will not throw an error when any valid HTTP status code is returned by the remote server, including 404 "Not Found" and 500 "Internal Server Error". The status code for such responses can be retrieved by calling ',(0,s.jsx)(r.a,{href:"/next/api/puppeteer.httpresponse.status",children:"HTTPResponse.status()"}),"."]})]})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"hover",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.hover",children:"hover(selector)"})})}),(0,s.jsx)("td",{}),(0,s.jsx)("td",{children:(0,s.jsxs)(r.p,{children:["Hovers the pointer over the center of the first element that matches the ",(0,s.jsx)(r.code,{children:"selector"}),"."]})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"isdetached",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.isdetached",children:"isDetached()"})})}),(0,s.jsx)("td",{children:(0,s.jsx)(r.p,{children:(0,s.jsx)(r.code,{children:"deprecated"})})}),(0,s.jsxs)("td",{children:[(0,s.jsxs)(r.p,{children:["Is",(0,s.jsx)(r.code,{children:"true"})," if the frame has been detached. Otherwise, ",(0,s.jsx)(r.code,{children:"false"}),"."]}),(0,s.jsx)(r.p,{children:(0,s.jsx)(r.strong,{children:"Deprecated:"})}),(0,s.jsxs)(r.p,{children:["Use the ",(0,s.jsx)(r.code,{children:"detached"})," getter."]})]})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"isoopframe",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.isoopframe",children:"isOOPFrame()"})})}),(0,s.jsx)("td",{children:(0,s.jsx)(r.p,{children:(0,s.jsx)(r.code,{children:"deprecated"})})}),(0,s.jsxs)("td",{children:[(0,s.jsxs)(r.p,{children:["Is ",(0,s.jsx)(r.code,{children:"true"})," if the frame is an out-of-process (OOP) frame. Otherwise, ",(0,s.jsx)(r.code,{children:"false"}),"."]}),(0,s.jsx)(r.p,{children:(0,s.jsx)(r.strong,{children:"Deprecated:"})}),(0,s.jsx)(r.p,{children:"Generally, there should be no difference between local and out-of-process frames from the Puppeteer API perspective. This is an implementation detail that should not have been exposed."})]})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"locator",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.locator",children:"locator(selector)"})})}),(0,s.jsx)("td",{}),(0,s.jsxs)("td",{children:[(0,s.jsxs)(r.p,{children:["Creates a locator for the provided selector. See ",(0,s.jsx)(r.a,{href:"/next/api/puppeteer.locator",children:"Locator"})," for details and supported actions."]}),(0,s.jsx)(r.p,{children:(0,s.jsx)(r.strong,{children:"Remarks:"})}),(0,s.jsx)(r.p,{children:"Locators API is experimental and we will not follow semver for breaking change in the Locators API."})]})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"locator",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.locator_1",children:"locator(func)"})})}),(0,s.jsx)("td",{}),(0,s.jsxs)("td",{children:[(0,s.jsxs)(r.p,{children:["Creates a locator for the provided function. See ",(0,s.jsx)(r.a,{href:"/next/api/puppeteer.locator",children:"Locator"})," for details and supported actions."]}),(0,s.jsx)(r.p,{children:(0,s.jsx)(r.strong,{children:"Remarks:"})}),(0,s.jsx)(r.p,{children:"Locators API is experimental and we will not follow semver for breaking change in the Locators API."})]})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"name",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.name",children:"name()"})})}),(0,s.jsx)("td",{children:(0,s.jsx)(r.p,{children:(0,s.jsx)(r.code,{children:"deprecated"})})}),(0,s.jsxs)("td",{children:[(0,s.jsxs)(r.p,{children:["The frame's ",(0,s.jsx)(r.code,{children:"name"})," attribute as specified in the tag."]}),(0,s.jsx)(r.p,{children:(0,s.jsx)(r.strong,{children:"Deprecated:"})}),(0,s.jsx)(r.p,{children:"Use"}),(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-ts",children:"const element = await frame.frameElement();\nconst nameOrId = await element.evaluate(frame => frame.name ?? frame.id);\n"})}),(0,s.jsx)(r.p,{children:(0,s.jsx)(r.strong,{children:"Remarks:"})}),(0,s.jsx)(r.p,{children:"This value is calculated once when the frame is created, and will not update if the attribute is changed later."})]})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"page",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.page",children:"page()"})})}),(0,s.jsx)("td",{}),(0,s.jsx)("td",{children:(0,s.jsx)(r.p,{children:"The page associated with the frame."})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"parentframe",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.parentframe",children:"parentFrame()"})})}),(0,s.jsx)("td",{}),(0,s.jsx)("td",{children:(0,s.jsxs)(r.p,{children:["The parent frame, if any. Detached and main frames return ",(0,s.jsx)(r.code,{children:"null"}),"."]})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"select",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.select",children:"select(selector, values)"})})}),(0,s.jsx)("td",{}),(0,s.jsx)("td",{children:(0,s.jsxs)(r.p,{children:["Selects a set of value on the first ",(0,s.jsx)(r.code,{children:"<select>"})," element that matches the ",(0,s.jsx)(r.code,{children:"selector"}),"."]})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"setcontent",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.setcontent",children:"setContent(html, options)"})})}),(0,s.jsx)("td",{}),(0,s.jsx)("td",{children:(0,s.jsx)(r.p,{children:"Set the content of the frame."})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"tap",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.tap",children:"tap(selector)"})})}),(0,s.jsx)("td",{}),(0,s.jsx)("td",{children:(0,s.jsxs)(r.p,{children:["Taps the first element that matches the ",(0,s.jsx)(r.code,{children:"selector"}),"."]})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"title",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.title",children:"title()"})})}),(0,s.jsx)("td",{}),(0,s.jsx)("td",{children:(0,s.jsx)(r.p,{children:"The frame's title."})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"type",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.type",children:"type(selector, text, options)"})})}),(0,s.jsx)("td",{}),(0,s.jsxs)("td",{children:[(0,s.jsxs)(r.p,{children:["Sends a ",(0,s.jsx)(r.code,{children:"keydown"}),", ",(0,s.jsx)(r.code,{children:"keypress"}),"/",(0,s.jsx)(r.code,{children:"input"}),", and ",(0,s.jsx)(r.code,{children:"keyup"})," event for each character in the text."]}),(0,s.jsx)(r.p,{children:(0,s.jsx)(r.strong,{children:"Remarks:"})}),(0,s.jsxs)(r.p,{children:["To press a special key, like ",(0,s.jsx)(r.code,{children:"Control"})," or ",(0,s.jsx)(r.code,{children:"ArrowDown"}),", use ",(0,s.jsx)(r.a,{href:"/next/api/puppeteer.keyboard.press",children:"Keyboard.press()"}),"."]})]})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"url",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.url",children:"url()"})})}),(0,s.jsx)("td",{}),(0,s.jsx)("td",{children:(0,s.jsx)(r.p,{children:"The frame's URL."})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"waitforfunction",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.waitforfunction",children:"waitForFunction(pageFunction, options, args)"})})}),(0,s.jsx)("td",{}),(0,s.jsx)("td",{})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"waitfornavigation",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.waitfornavigation",children:"waitForNavigation(options)"})})}),(0,s.jsx)("td",{}),(0,s.jsxs)("td",{children:[(0,s.jsx)(r.p,{children:"Waits for the frame to navigate. It is useful for when you run code which will indirectly cause the frame to navigate."}),(0,s.jsxs)(r.p,{children:["Usage of the ",(0,s.jsx)(r.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,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:(0,s.jsx)("span",{id:"waitforselector",children:(0,s.jsx)(r.a,{href:"/next/api/puppeteer.frame.waitforselector",children:"waitForSelector(selector, options)"})})}),(0,s.jsx)("td",{}),(0,s.jsxs)("td",{children:[(0,s.jsx)(r.p,{children:"Waits for an element matching the given selector to appear in the frame."}),(0,s.jsx)(r.p,{children:"This method works across navigations."})]})]})]})]})]})}function p(e={}){const{wrapper:r}={...(0,n.a)(),...e.components};return r?(0,s.jsx)(r,{...e,children:(0,s.jsx)(h,{...e})}):h(e)}},75251:(e,r,t)=>{var s=t(67294),n=Symbol.for("react.element"),i=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,d=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,r,t){var s,i={},c=null,h=null;for(s in void 0!==t&&(c=""+t),void 0!==r.key&&(c=""+r.key),void 0!==r.ref&&(h=r.ref),r)a.call(r,s)&&!l.hasOwnProperty(s)&&(i[s]=r[s]);if(e&&e.defaultProps)for(s in r=e.defaultProps)void 0===i[s]&&(i[s]=r[s]);return{$$typeof:n,type:e,key:c,ref:h,props:i,_owner:d.current}}r.Fragment=i,r.jsx=c,r.jsxs=c},85893:(e,r,t)=>{e.exports=t(75251)},11151:(e,r,t)=>{t.d(r,{Z:()=>d,a:()=>a});var s=t(67294);const n={},i=s.createContext(n);function a(e){const r=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function d(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:a(e.components),s.createElement(i.Provider,{value:r},e.children)}}}]);