mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
2 lines
4.8 KiB
JavaScript
2 lines
4.8 KiB
JavaScript
/*! For license information please see b0bcc013.472872ad.js.LICENSE.txt */
|
|
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[64249],{52637:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>d,default:()=>c,frontMatter:()=>i,metadata:()=>a,toc:()=>o});var r=t(85893),s=t(11151);const i={sidebar_label:"ElementHandle.press"},d="ElementHandle.press() method",a={id:"api/puppeteer.elementhandle.press",title:"ElementHandle.press() method",description:"Focuses the element, and then uses Keyboard.down() and Keyboard.up().",source:"@site/../docs/api/puppeteer.elementhandle.press.md",sourceDirName:"api",slug:"/api/puppeteer.elementhandle.press",permalink:"/next/api/puppeteer.elementhandle.press",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{sidebar_label:"ElementHandle.press"},sidebar:"api",previous:{title:"ElementHandle.isVisible",permalink:"/next/api/puppeteer.elementhandle.isvisible"},next:{title:"ElementHandle.screenshot",permalink:"/next/api/puppeteer.elementhandle.screenshot"}},l={},o=[{value:"Signature:",id:"signature",level:4},{value:"Parameters",id:"parameters",level:2},{value:"Remarks",id:"remarks",level:2}];function p(e){const n={a:"a",code:"code",em:"em",h1:"h1",h2:"h2",h4:"h4",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,s.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h1,{id:"elementhandlepress-method",children:"ElementHandle.press() method"}),"\n",(0,r.jsxs)(n.p,{children:["Focuses the element, and then uses ",(0,r.jsx)(n.a,{href:"/next/api/puppeteer.keyboard.down",children:"Keyboard.down()"})," and ",(0,r.jsx)(n.a,{href:"/next/api/puppeteer.keyboard.up",children:"Keyboard.up()"}),"."]}),"\n",(0,r.jsx)(n.h4,{id:"signature",children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"class ElementHandle {\n press(key: KeyInput, options?: Readonly<KeyPressOptions>): Promise<void>;\n}\n"})}),"\n",(0,r.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,r.jsxs)(n.table,{children:[(0,r.jsx)(n.thead,{children:(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.th,{children:"Parameter"}),(0,r.jsx)(n.th,{children:"Type"}),(0,r.jsx)(n.th,{children:"Description"})]})}),(0,r.jsxs)(n.tbody,{children:[(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"key"}),(0,r.jsx)(n.td,{children:(0,r.jsx)(n.a,{href:"/next/api/puppeteer.keyinput",children:"KeyInput"})}),(0,r.jsxs)(n.td,{children:["Name of key to press, such as ",(0,r.jsx)("code",{children:"ArrowLeft"}),". See ",(0,r.jsx)(n.a,{href:"/next/api/puppeteer.keyinput",children:"KeyInput"})," for a list of all key names."]})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"options"}),(0,r.jsxs)(n.td,{children:["Readonly<",(0,r.jsx)(n.a,{href:"/next/api/puppeteer.keypressoptions",children:"KeyPressOptions"}),">"]}),(0,r.jsx)(n.td,{children:(0,r.jsx)(n.em,{children:"(Optional)"})})]})]})]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,r.jsx)(n.p,{children:"Promise<void>"}),"\n",(0,r.jsx)(n.h2,{id:"remarks",children:"Remarks"}),"\n",(0,r.jsxs)(n.p,{children:["If ",(0,r.jsx)(n.code,{children:"key"})," is a single character and no modifier keys besides ",(0,r.jsx)(n.code,{children:"Shift"})," are being held down, a ",(0,r.jsx)(n.code,{children:"keypress"}),"/",(0,r.jsx)(n.code,{children:"input"})," event will also be generated. The ",(0,r.jsx)(n.code,{children:"text"})," option can be specified to force an input event to be generated."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"NOTE"})," Modifier keys DO affect ",(0,r.jsx)(n.code,{children:"elementHandle.press"}),". Holding down ",(0,r.jsx)(n.code,{children:"Shift"})," will type the text in upper case."]})]})}function c(e={}){const{wrapper:n}={...(0,s.a)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},75251:(e,n,t)=>{var r=t(67294),s=Symbol.for("react.element"),i=Symbol.for("react.fragment"),d=Object.prototype.hasOwnProperty,a=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function o(e,n,t){var r,i={},o=null,p=null;for(r in void 0!==t&&(o=""+t),void 0!==n.key&&(o=""+n.key),void 0!==n.ref&&(p=n.ref),n)d.call(n,r)&&!l.hasOwnProperty(r)&&(i[r]=n[r]);if(e&&e.defaultProps)for(r in n=e.defaultProps)void 0===i[r]&&(i[r]=n[r]);return{$$typeof:s,type:e,key:o,ref:p,props:i,_owner:a.current}}n.Fragment=i,n.jsx=o,n.jsxs=o},85893:(e,n,t)=>{e.exports=t(75251)},11151:(e,n,t)=>{t.d(n,{Z:()=>a,a:()=>d});var r=t(67294);const s={},i=r.createContext(s);function d(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:d(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]); |