puppeteer/assets/js/8bdeb9c6.155bd81c.js
release-please[bot] a0a03cf95e deploy: 1847704789
2022-10-10 14:36:05 +00:00

1 line
7.4 KiB
JavaScript

"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[46727],{3905:(e,n,a)=>{a.d(n,{Zo:()=>s,kt:()=>P});var t=a(67294);function r(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function o(e,n){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),a.push.apply(a,t)}return a}function i(e){for(var n=1;n<arguments.length;n++){var a=null!=arguments[n]?arguments[n]:{};n%2?o(Object(a),!0).forEach((function(n){r(e,n,a[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(a,n))}))}return e}function l(e,n){if(null==e)return{};var a,t,r=function(e,n){if(null==e)return{};var a,t,r={},o=Object.keys(e);for(t=0;t<o.length;t++)a=o[t],n.indexOf(a)>=0||(r[a]=e[a]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t<o.length;t++)a=o[t],n.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=t.createContext({}),c=function(e){var n=t.useContext(p),a=n;return e&&(a="function"==typeof e?e(n):i(i({},n),e)),a},s=function(e){var n=c(e.components);return t.createElement(p.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},d=t.forwardRef((function(e,n){var a=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),d=c(a),P=r,h=d["".concat(p,".").concat(P)]||d[P]||u[P]||o;return a?t.createElement(h,i(i({ref:n},s),{},{components:a})):t.createElement(h,i({ref:n},s))}));function P(e,n){var a=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=d;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var c=2;c<o;c++)i[c]=a[c];return t.createElement.apply(null,i)}return t.createElement.apply(null,a)}d.displayName="MDXCreateElement"},48271:(e,n,a)=>{a.r(n),a.d(n,{assets:()=>c,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>p,toc:()=>s});a(67294);var t=a(3905);function r(){return r=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var a=arguments[n];for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&(e[t]=a[t])}return e},r.apply(this,arguments)}function o(e,n){if(null==e)return{};var a,t,r=function(e,n){if(null==e)return{};var a,t,r={},o=Object.keys(e);for(t=0;t<o.length;t++)a=o[t],n.indexOf(a)>=0||(r[a]=e[a]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t<o.length;t++)a=o[t],n.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}const i={sidebar_label:"KnownDevices"},l="KnownDevices variable",p={unversionedId:"api/puppeteer.knowndevices",id:"api/puppeteer.knowndevices",title:"KnownDevices variable",description:"A list of devices to be used with Page.emulate().",source:"@site/../docs/api/puppeteer.knowndevices.md",sourceDirName:"api",slug:"/api/puppeteer.knowndevices",permalink:"/next/api/puppeteer.knowndevices",draft:!1,tags:[],version:"current",frontMatter:{sidebar_label:"KnownDevices"},sidebar:"sidebar",previous:{title:"KeyInput",permalink:"/next/api/puppeteer.keyinput"},next:{title:"launch",permalink:"/next/api/puppeteer.launch"}},c={},s=[{value:"Example",id:"example",level:2}],u={toc:s};function d(e){var{components:n}=e,a=o(e,["components"]);return(0,t.kt)("wrapper",r({},u,a,{components:n,mdxType:"MDXLayout"}),(0,t.kt)("h1",r({},{id:"knowndevices-variable"}),"KnownDevices variable"),(0,t.kt)("p",null,"A list of devices to be used with ",(0,t.kt)("a",r({parentName:"p"},{href:"/next/api/puppeteer.page.emulate"}),"Page.emulate()"),"."),(0,t.kt)("p",null,(0,t.kt)("strong",{parentName:"p"},"Signature:")),(0,t.kt)("pre",null,(0,t.kt)("code",r({parentName:"pre"},{className:"language-typescript"}),"KnownDevices: Readonly<\n Record<\n | 'Blackberry PlayBook'\n | 'Blackberry PlayBook landscape'\n | 'BlackBerry Z30'\n | 'BlackBerry Z30 landscape'\n | 'Galaxy Note 3'\n | 'Galaxy Note 3 landscape'\n | 'Galaxy Note II'\n | 'Galaxy Note II landscape'\n | 'Galaxy S III'\n | 'Galaxy S III landscape'\n | 'Galaxy S5'\n | 'Galaxy S5 landscape'\n | 'Galaxy S8'\n | 'Galaxy S8 landscape'\n | 'Galaxy S9+'\n | 'Galaxy S9+ landscape'\n | 'Galaxy Tab S4'\n | 'Galaxy Tab S4 landscape'\n | 'iPad'\n | 'iPad landscape'\n | 'iPad (gen 6)'\n | 'iPad (gen 6) landscape'\n | 'iPad (gen 7)'\n | 'iPad (gen 7) landscape'\n | 'iPad Mini'\n | 'iPad Mini landscape'\n | 'iPad Pro'\n | 'iPad Pro landscape'\n | 'iPad Pro 11'\n | 'iPad Pro 11 landscape'\n | 'iPhone 4'\n | 'iPhone 4 landscape'\n | 'iPhone 5'\n | 'iPhone 5 landscape'\n | 'iPhone 6'\n | 'iPhone 6 landscape'\n | 'iPhone 6 Plus'\n | 'iPhone 6 Plus landscape'\n | 'iPhone 7'\n | 'iPhone 7 landscape'\n | 'iPhone 7 Plus'\n | 'iPhone 7 Plus landscape'\n | 'iPhone 8'\n | 'iPhone 8 landscape'\n | 'iPhone 8 Plus'\n | 'iPhone 8 Plus landscape'\n | 'iPhone SE'\n | 'iPhone SE landscape'\n | 'iPhone X'\n | 'iPhone X landscape'\n | 'iPhone XR'\n | 'iPhone XR landscape'\n | 'iPhone 11'\n | 'iPhone 11 landscape'\n | 'iPhone 11 Pro'\n | 'iPhone 11 Pro landscape'\n | 'iPhone 11 Pro Max'\n | 'iPhone 11 Pro Max landscape'\n | 'iPhone 12'\n | 'iPhone 12 landscape'\n | 'iPhone 12 Pro'\n | 'iPhone 12 Pro landscape'\n | 'iPhone 12 Pro Max'\n | 'iPhone 12 Pro Max landscape'\n | 'iPhone 12 Mini'\n | 'iPhone 12 Mini landscape'\n | 'iPhone 13'\n | 'iPhone 13 landscape'\n | 'iPhone 13 Pro'\n | 'iPhone 13 Pro landscape'\n | 'iPhone 13 Pro Max'\n | 'iPhone 13 Pro Max landscape'\n | 'iPhone 13 Mini'\n | 'iPhone 13 Mini landscape'\n | 'JioPhone 2'\n | 'JioPhone 2 landscape'\n | 'Kindle Fire HDX'\n | 'Kindle Fire HDX landscape'\n | 'LG Optimus L70'\n | 'LG Optimus L70 landscape'\n | 'Microsoft Lumia 550'\n | 'Microsoft Lumia 950'\n | 'Microsoft Lumia 950 landscape'\n | 'Nexus 10'\n | 'Nexus 10 landscape'\n | 'Nexus 4'\n | 'Nexus 4 landscape'\n | 'Nexus 5'\n | 'Nexus 5 landscape'\n | 'Nexus 5X'\n | 'Nexus 5X landscape'\n | 'Nexus 6'\n | 'Nexus 6 landscape'\n | 'Nexus 6P'\n | 'Nexus 6P landscape'\n | 'Nexus 7'\n | 'Nexus 7 landscape'\n | 'Nokia Lumia 520'\n | 'Nokia Lumia 520 landscape'\n | 'Nokia N9'\n | 'Nokia N9 landscape'\n | 'Pixel 2'\n | 'Pixel 2 landscape'\n | 'Pixel 2 XL'\n | 'Pixel 2 XL landscape'\n | 'Pixel 3'\n | 'Pixel 3 landscape'\n | 'Pixel 4'\n | 'Pixel 4 landscape'\n | 'Pixel 4a (5G)'\n | 'Pixel 4a (5G) landscape'\n | 'Pixel 5'\n | 'Pixel 5 landscape'\n | 'Moto G4'\n | 'Moto G4 landscape',\n Device\n >\n>;\n")),(0,t.kt)("h2",r({},{id:"example"}),"Example"),(0,t.kt)("pre",null,(0,t.kt)("code",r({parentName:"pre"},{className:"language-ts"}),"import {KnownDevices} from 'puppeteer';\nconst iPhone = KnownDevices['iPhone 6'];\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.emulate(iPhone);\n await page.goto('https://www.google.com');\n // other actions...\n await browser.close();\n})();\n")))}d.isMDXComponent=!0}}]);