puppeteer/assets/js/f6e39c3e.d8b892e2.js
2021-10-07 15:21:45 +00:00

1 line
5.0 KiB
JavaScript

"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[40261],{3905:function(e,t,r){r.d(t,{Zo:function(){return s},kt:function(){return m}});var p=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);t&&(p=p.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,p)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,p,n=function(e,t){if(null==e)return{};var r,p,n={},o=Object.keys(e);for(p=0;p<o.length;p++)r=o[p],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(p=0;p<o.length;p++)r=o[p],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var u=p.createContext({}),c=function(e){var t=p.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},s=function(e){var t=c(e.components);return p.createElement(u.Provider,{value:t},e.children)},l={inlineCode:"code",wrapper:function(e){var t=e.children;return p.createElement(p.Fragment,{},t)}},d=p.forwardRef((function(e,t){var r=e.components,n=e.mdxType,o=e.originalType,u=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),d=c(r),m=n,f=d["".concat(u,".").concat(m)]||d[m]||l[m]||o;return r?p.createElement(f,a(a({ref:t},s),{},{components:r})):p.createElement(f,a({ref:t},s))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=r.length,a=new Array(o);a[0]=d;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i.mdxType="string"==typeof e?e:n,a[1]=i;for(var c=2;c<o;c++)a[c]=r[c];return p.createElement.apply(null,a)}return p.createElement.apply(null,r)}d.displayName="MDXCreateElement"},96460:function(e,t,r){r.r(t),r.d(t,{frontMatter:function(){return i},contentTitle:function(){return u},metadata:function(){return c},toc:function(){return s},default:function(){return d}});var p=r(87462),n=r(63366),o=(r(67294),r(3905)),a=["components"],i={},u=void 0,c={unversionedId:"puppeteer.puppeteer.devices",id:"version-10.0.0/puppeteer.puppeteer.devices",isDocsHomePage:!1,title:"puppeteer.puppeteer.devices",description:"Home &gt; puppeteer &gt; Puppeteer &gt; devices",source:"@site/versioned_docs/version-10.0.0/puppeteer.puppeteer.devices.md",sourceDirName:".",slug:"/puppeteer.puppeteer.devices",permalink:"/puppeteer/docs/10.0.0/puppeteer.puppeteer.devices",editUrl:"https://github.com/facebook/puppeteer/edit/main/website/versioned_docs/version-10.0.0/puppeteer.puppeteer.devices.md",version:"10.0.0",frontMatter:{},sidebar:"version-10.0.0/docs",previous:{title:"puppeteer.puppeteer.customqueryhandlernames",permalink:"/puppeteer/docs/10.0.0/puppeteer.puppeteer.customqueryhandlernames"},next:{title:"puppeteer.puppeteer.errors",permalink:"/puppeteer/docs/10.0.0/puppeteer.puppeteer.errors"}},s=[{value:"Puppeteer.devices property",id:"puppeteerdevices-property",children:[]},{value:"Remarks",id:"remarks",children:[]},{value:"Example",id:"example",children:[]}],l={toc:s};function d(e){var t=e.components,r=(0,n.Z)(e,a);return(0,o.kt)("wrapper",(0,p.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"/puppeteer/docs/10.0.0/index"},"Home")," ",">"," ",(0,o.kt)("a",{parentName:"p",href:"/puppeteer/docs/10.0.0/puppeteer"},"puppeteer")," ",">"," ",(0,o.kt)("a",{parentName:"p",href:"/puppeteer/docs/10.0.0/puppeteer.puppeteer"},"Puppeteer")," ",">"," ",(0,o.kt)("a",{parentName:"p",href:"/puppeteer/docs/10.0.0/puppeteer.puppeteer.devices"},"devices")),(0,o.kt)("h2",{id:"puppeteerdevices-property"},"Puppeteer.devices property"),(0,o.kt)("b",null,"Signature:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"get devices(): DevicesMap;\n")),(0,o.kt)("h2",{id:"remarks"},"Remarks"),(0,o.kt)("p",null,"A list of devices to be used with ",(0,o.kt)("inlineCode",{parentName:"p"},"page.emulate(options)"),". Actual list of devices can be found in ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/puppeteer/puppeteer/blob/main/src/common/DeviceDescriptors.ts"},"src/common/DeviceDescriptors.ts"),"."),(0,o.kt)("h2",{id:"example"},"Example"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"const puppeteer = require('puppeteer');\nconst iPhone = puppeteer.devices['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\n")))}d.isMDXComponent=!0}}]);