1"use strict";(self.webpackChunkplaywright_dev=self.webpackChunkplaywright_dev||[]).push([["3653"],{81208(e,n,s){s.r(n),s.d(n,{metadata:()=>a,default:()=>h,frontMatter:()=>i,contentTitle:()=>t,toc:()=>o,assets:()=>d});var a=JSON.parse('{"id":"api/class-jshandle","title":"JSHandle","description":"JSHandle represents an in-page JavaScript object. JSHandles can be created with the page.evaluateHandle() method.","source":"@site/versioned_docs/version-stable/api/class-jshandle.mdx","sourceDirName":"api","slug":"/api/class-jshandle","permalink":"/docs/api/class-jshandle","draft":false,"unlisted":false,"tags":[],"version":"stable","frontMatter":{"id":"class-jshandle","title":"JSHandle"},"sidebar":"api","previous":{"title":"FrameLocator","permalink":"/docs/api/class-framelocator"},"next":{"title":"Keyboard","permalink":"/docs/api/class-keyboard"}}'),l=s(74848),r=s(28453);s(13554),s(41647),s(83137);let i={id:"class-jshandle",title:"JSHandle"},t,d={},o=[{value:"Methods",id:"methods",level:2},{value:"asElement",id:"js-handle-as-element",level:3},{value:"dispose",id:"js-handle-dispose",level:3},{value:"evaluate",id:"js-handle-evaluate",level:3},{value:"evaluateHandle",id:"js-handle-evaluate-handle",level:3},{value:"getProperties",id:"js-handle-get-properties",level:3},{value:"getProperty",id:"js-handle-get-property",level:3},{value:"jsonValue",id:"js-handle-json-value",level:3}];function c(e){let n={a:"a",admonition:"admonition",code:"code",em:"em",h2:"h2",h3:"h3",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(n.p,{children:["JSHandle represents an in-page JavaScript object. JSHandles can be created with the ",(0,l.jsx)(n.a,{href:"/docs/api/class-page#page-evaluate-handle",children:"page.evaluateHandle()"})," method."]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-js",children:"const windowHandle = await page.evaluateHandle(() => window);\n// ...\n"})}),"\n",(0,l.jsxs)(n.p,{children:["JSHandle prevents the referenced JavaScript object being garbage collected unless the handle is exposed with ",(0,l.jsx)(n.a,{href:"/docs/api/class-js
1handle#js-handle-dispose",children:"jsHandle.dispose()"}),". JSHandles are auto-disposed when their origin frame gets navigated or the parent context gets destroyed."]}),"\n",(0,l.jsxs)(n.p,{children:["JSHandle instances can be used as an argument in ",(0,l.jsx)(n.a,{href:"/docs/api/class-page#page-eval-on-selector",children:"page.$eval()"}),", ",(0,l.jsx)(n.a,{href:"/docs/api/class-page#page-evaluate",children:"page.evaluate()"})," and ",(0,l.jsx)(n.a,{href:"/docs/api/class-page#page-evaluate-handle",children:"page.evaluateHandle()"})," methods."]}),"\n",(0,l.jsx)(n.hr,{}),"\n",(0,l.jsx)(n.h2,{id:"methods",children:"Methods"}),"\n",(0,l.jsx)(n.h3,{id:"js-handle-as-element",children:"asElement"}),"\n",(0,l.jsx)("font",{size:"2",style:{position:"relative",top:"-20px"},children:"Added before v1.9"}),"\n",(0,l.jsx)("x-search",{children:"jsHandle.asElement"}),"\n",(0,l.jsxs)(n.p,{children:["Returns either ",(0,l.jsx)(n.code,{children:"null"})," or the object handle itself, if the object handle is an instance of ",(0,l.jsx)(n.a,{href:"/docs/api/class-elementhandle",title:"ElementHandle",children:"ElementHandle"}),"."]}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"Usage"})}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-js",children:"jsHandle.asElement();\n"})}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"Returns"})}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null",title:"null",children:"null"})," | ",(0,l.jsx)(n.a,{href:"/docs/api/class-elementhandle",title:"ElementHandle",children:"ElementHandle"}),(0,l.jsx)("a",{"aria-hidden":"true",tabIndex:"-1",class:"list-anchor-link",id:"js-handle-as-element-return"}),(0,l.jsx)("a",{href:"#js-handle-as-element-return",class:"list-anchor",children:"#"})]}),"\n"]}),"\n",(0,l.jsx)(n.hr,{}),"\n",(0,l.jsx)(n.h3,{id:"js-handle-dispose",children:"dispose"}),"\n",(0,l.jsx)("font",{size:"2",style:{position:"relative",top:"-20px"},children:"Added before v1.9"}),"\n",(0,l.jsx)("x-search",{children:"jsHandle.dispose"}),"\n",(0,l.jsxs)(n.p,{children:["The ",(0,l.jsx)(n.code,{children:"jsHandle.dispose"})," method stops referencing the element handle."]}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"Usage"})}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-js",children:"await jsHandle.dispose();\n"})}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"Returns"})}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise",title:"Promise",children:"Promise"}),"<",(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined",title:"void",children:"void"}),">",(0,l.jsx)("a",{"aria-hidden":"true",tabIndex:"-1",class:"list-anchor-link",id:"js-handle-dispose-return"}),(0,l.jsx)("a",{href:"#js-handle-dispose-return",class:"list-anchor",children:"#"})]}),"\n"]}),"\n",(0,l.jsx)(n.hr,{}),"\n",(0,l.jsx)(n.h3,{id:"js-handle-evaluate",children:"evaluate"}),"\n",(0,l.jsx)("font",{size:"2",style:{position:"relative",top:"-20px"},children:"Added before v1.9"}),"\n",(0,l.jsx)("x-search",{children:"jsHandle.evaluate"}),"\n",(0,l.jsxs)(n.p,{children:["Returns the return value of ",(0,l.jsx)(n.a,{href:"/docs/api/class-js
1handle#js-handle-evaluate-option-expression",children:"pageFunction"}),"."]}),"\n",(0,l.jsxs)(n.p,{children:["This method passes this handle as the first argument to ",(0,l.jsx)(n.a,{href:"/docs/api/class-jshandle#js-handle-evaluate-option-expression",children:"pageFunction"}),"."]}),"\n",(0,l.jsxs)(n.p,{children:["If ",(0,l.jsx)(n.a,{href:"/docs/api/class-jshandle#js-handle-evaluate-option-expression",children:"pageFunction"})," returns a ",(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise",title:"Promise",children:"Promise"}),", then ",(0,l.jsx)(n.code,{children:"handle.evaluate"})," would wait for the promise to resolve and return its value."]}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"Usage"})}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-js",children:"const tweetHandle = await page.$('.tweet .retweets');\nexpect(await tweetHandle.evaluate(node => node.innerText)).toBe('10 retweets');\n"})}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"Arguments"})}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:["\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.code,{children:"pageFunction"})," ",(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function",title:"Function",children:"function"})," | ",(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type",title:"string",children:"string"}),(0,l.jsx)("a",{"aria-hidden":"true",tabIndex:"-1",class:"list-anchor-link",id:"js-handle-evaluate-option-expression"}),(0,l.jsx)("a",{href:"#js-handle-evaluate-option-expression",class:"list-anchor",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"Function to be evaluated in the page context."}),"\n"]}),"\n",(0,l.jsxs)(n.li,{children:["\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.code,{children:"arg"})," ",(0,l.jsx)(n.a,{href:"/docs/evaluating#evaluation-argument",title:"EvaluationArgument",children:"EvaluationArgument"})," ",(0,l.jsx)(n.em,{children:"(optional)"}),(0,l.jsx)("a",{"aria-hidden":"true",tabIndex:"-1",class:"list-anchor-link",id:"js-handle-evaluate-option-arg"}),(0,l.jsx)("a",{href:"#js-handle-evaluate-option-arg",class:"list-anchor",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["Optional argument to pass to ",(0,l.jsx)(n.a,{href:"/docs/api/class-js
1handle#js-handle-evaluate-option-expression",children:"pageFunction"}),"."]}),"\n"]}),"\n",(0,l.jsxs)(n.li,{children:["\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.code,{children:"options"})," ",(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object",title:"Object",children:"Object"})," ",(0,l.jsx)(n.em,{children:"(optional)"})]}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:["\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.code,{children:"exposeFunctions"})," ",(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type",title:"Boolean",children:"boolean"})," ",(0,l.jsx)(n.em,{children:"(optional)"})," ",(0,l.jsx)("font",{size:"2",children:"Added in: v1.62"}),(0,l.jsx)("a",{"aria-hidden":"true",tabIndex:"-1",class:"list-anchor-link",id:"js-handle-evaluate-option-expose-functions"}),(0,l.jsx)("a",{href:"#js-handle-evaluate-option-expose-functions",class:"list-anchor",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["When set to ",(0,l.jsx)(n.code,{children:"true"}),", functions passed inside ",(0,l.jsx)(n.a,{href:"/docs/api/class-js
1handle#js-handle-evaluate-option-arg",children:"arg"})," are exposed in the page and can be called from the page function. Calling one returns a ",(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise",title:"Promise",children:"Promise"})," of its result. Under the hood, each function is exposed via ",(0,l.jsx)(n.a,{href:"/docs/api/class-page#page-expose-function",children:"page.exposeFunction()"}),", so it is technically accessible from all frames and worlds of the page. Exposed functions are cleared upon the top-level navigation. Defaults to ",(0,l.jsx)(n.code,{children:"false"}),", in which case functions are not serializable and passing one throws an error."]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"Returns"})}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise",title:"Promise",children:"Promise"}),"<",(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Description",title:"Serializable",children:"Serializable"}),">",(0,l.jsx)("a",{"aria-hidden":"true",tabIndex:"-1",class:"list-anchor-link",id:"js-handle-evaluate-return"}),(0,l.jsx)("a",{href:"#js-handle-evaluate-return",class:"list-anchor",children:"#"})]}),"\n"]}),"\n",(0,l.jsx)(n.hr,{}),"\n",(0,l.jsx)(n.h3,{id:"js-handle-evaluate-handle",children:"evaluateHandle"}),"\n",(0,l.jsx)("font",{size:"2",style:{position:"relative",top:"-20px"},children:"Added before v1.9"}),"\n",(0,l.jsx)("x-search",{children:"jsHandle.evaluateHandle"}),"\n",(0,l.jsxs)(n.p,{children:["Returns the return value of ",(0,l.jsx)(n.a,{href:"/docs/api/class-js
1handle#js-handle-evaluate-handle-option-expression",children:"pageFunction"})," as a ",(0,l.jsx)(n.a,{href:"/docs/api/class-jshandle",title:"JSHandle",children:"JSHandle"}),"."]}),"\n",(0,l.jsxs)(n.p,{children:["This method passes this handle as the first argument to ",(0,l.jsx)(n.a,{href:"/docs/api/class-jshandle#js-handle-evaluate-handle-option-expression",children:"pageFunction"}),"."]}),"\n",(0,l.jsxs)(n.p,{children:["The only difference between ",(0,l.jsx)(n.code,{children:"jsHandle.evaluate"})," and ",(0,l.jsx)(n.code,{children:"jsHandle.evaluateHandle"})," is that ",(0,l.jsx)(n.code,{children:"jsHandle.evaluateHandle"})," returns ",(0,l.jsx)(n.a,{href:"/docs/api/class-jshandle",title:"JSHandle",children:"JSHandle"}),"."]}),"\n",(0,l.jsxs)(n.p,{children:["If the function passed to the ",(0,l.jsx)(n.code,{children:"jsHandle.evaluateHandle"})," returns a ",(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise",title:"Promise",children:"Promise"}),", then ",(0,l.jsx)(n.code,{children:"jsHandle.evaluateHandle"})," would wait for the promise to resolve and return its value."]}),"\n",(0,l.jsxs)(n.p,{children:["See ",(0,l.jsx)(n.a,{href:"/docs/api/class-page#page-evaluate-handle",children:"page.evaluateHandle()"})," for more details."]}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"Usage"})}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-js",children:"await jsHandle.evaluateHandle(pageFunction);\nawait jsHandle.evaluateHandle(pageFunction, arg, options);\n"})}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"Arguments"})}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:["\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.code,{children:"pageFunction"})," ",(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function",title:"Function",children:"function"})," | ",(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type",title:"string",children:"string"}),(0,l.jsx)("a",{"aria-hidden":"true",tabIndex:"-1",class:"list-anchor-link",id:"js-handle-evaluate-handle-option-expression"}),(0,l.jsx)("a",{href:"#js-handle-evaluate-handle-option-expression",class:"list-anchor",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"Function to be evaluated in the page context."}),"\n"]}),"\n",(0,l.jsxs)(n.li,{children:["\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.code,{children:"arg"})," ",(0,l.jsx)(n.a,{href:"/docs/evaluating#evaluation-argument",title:"EvaluationArgument",children:"EvaluationArgument"})," ",(0,l.jsx)(n.em,{children:"(optional)"}),(0,l.jsx)("a",{"aria-hidden":"true",tabIndex:"-1",class:"list-anchor-link",id:"js-handle-evaluate-handle-option-arg"}),(0,l.jsx)("a",{href:"#js-handle-evaluate-handle-option-arg",class:"list-anchor",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["Optional argument to pass to ",(0,l.jsx)(n.a,{href:"/docs/api/class-js
1handle#js-handle-evaluate-handle-option-expression",children:"pageFunction"}),"."]}),"\n"]}),"\n",(0,l.jsxs)(n.li,{children:["\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.code,{children:"options"})," ",(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object",title:"Object",children:"Object"})," ",(0,l.jsx)(n.em,{children:"(optional)"})]}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:["\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.code,{children:"exposeFunctions"})," ",(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type",title:"Boolean",children:"boolean"})," ",(0,l.jsx)(n.em,{children:"(optional)"})," ",(0,l.jsx)("font",{size:"2",children:"Added in: v1.62"}),(0,l.jsx)("a",{"aria-hidden":"true",tabIndex:"-1",class:"list-anchor-link",id:"js-handle-evaluate-handle-option-expose-functions"}),(0,l.jsx)("a",{href:"#js-handle-evaluate-handle-option-expose-functions",class:"list-anchor",children:"#"})]}),"\n",(0,l.jsxs)(n.p,{children:["When set to ",(0,l.jsx)(n.code,{children:"true"}),", functions passed inside ",(0,l.jsx)(n.a,{href:"/docs/api/class-js
1handle#js-handle-evaluate-handle-option-arg",children:"arg"})," are exposed in the page and can be called from the page function. Calling one returns a ",(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise",title:"Promise",children:"Promise"})," of its result. Under the hood, each function is exposed via ",(0,l.jsx)(n.a,{href:"/docs/api/class-page#page-expose-function",children:"page.exposeFunction()"}),", so it is technically accessible from all frames and worlds of the page. Exposed functions are cleared upon the top-level navigation. Defaults to ",(0,l.jsx)(n.code,{children:"false"}),", in which case functions are not serializable and passing one throws an error."]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"Returns"})}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise",title:"Promise",children:"Promise"}
1),"<",(0,l.jsx)(n.a,{href:"/docs/api/class-jshandle",title:"JSHandle",children:"JSHandle"}),">",(0,l.jsx)("a",{"aria-hidden":"true",tabIndex:"-1",class:"list-anchor-link",id:"js-handle-evaluate-handle-return"}),(0,l.jsx)("a",{href:"#js-handle-evaluate-handle-return",class:"list-anchor",children:"#"})]}),"\n"]}),"\n",(0,l.jsx)(n.hr,{}),"\n",(0,l.jsx)(n.h3,{id:"js-handle-get-properties",children:"getProperties"}),"\n",(0,l.jsx)("font",{size:"2",style:{position:"relative",top:"-20px"},children:"Added before v1.9"}),"\n",(0,l.jsx)("x-search",{children:"jsHandle.getProperties"}),"\n",(0,l.jsxs)(n.p,{children:["The method returns a map with ",(0,l.jsx)(n.strong,{children:"own property names"})," as keys and JSHandle instances for the property values."]}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"Usage"})}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-js",children:"const handle = await page.evaluateHandle(() => ({ window, document }));\nconst properties = await handle.getProperties();\nconst windowHandle = properties.get('window');\nconst documentHandle = properties.get('document');\nawait handle.dispose();\n"})}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"Returns"})}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise",title:"Promise",children:"Promise"}),"<",(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map",title:"Map",children:"Map"}),"<",(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type",title:"string",children:"string"}
1),", ",(0,l.jsx)(n.a,{href:"/docs/api/class-jshandle",title:"JSHandle",children:"JSHandle"}),">>",(0,l.jsx)("a",{"aria-hidden":"true",tabIndex:"-1",class:"list-anchor-link",id:"js-handle-get-properties-return"}),(0,l.jsx)("a",{href:"#js-handle-get-properties-return",class:"list-anchor",children:"#"})]}),"\n"]}),"\n",(0,l.jsx)(n.hr,{}),"\n",(0,l.jsx)(n.h3,{id:"js-handle-get-property",children:"getProperty"}),"\n",(0,l.jsx)("font",{size:"2",style:{position:"relative",top:"-20px"},children:"Added before v1.9"}),"\n",(0,l.jsx)("x-search",{children:"jsHandle.getProperty"}),"\n",(0,l.jsx)(n.p,{children:"Fetches a single property from the referenced object."}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"Usage"})}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-js",children:"await jsHandle.getProperty(propertyName);\n"})}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"Arguments"})}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:["\n",(0,l.jsxs)(n.p,{children:[(0,l.jsx)(n.code,{children:"propertyName"})," ",(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type",title:"string",children:"string"}),(0,l.jsx)("a",{"aria-hidden":"true",tabIndex:"-1",class:"list-anchor-link",id:"js-handle-get-property-option-property-name"}),(0,l.jsx)("a",{href:"#js-handle-get-property-option-property-name",class:"list-anchor",children:"#"})]}),"\n",(0,l.jsx)(n.p,{children:"property to get"}),"\n"]}),"\n"]}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"Returns"})}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise",title:"Promise",children:"Promise"}
1),"<",(0,l.jsx)(n.a,{href:"/docs/api/class-jshandle",title:"JSHandle",children:"JSHandle"}),">",(0,l.jsx)("a",{"aria-hidden":"true",tabIndex:"-1",class:"list-anchor-link",id:"js-handle-get-property-return"}),(0,l.jsx)("a",{href:"#js-handle-get-property-return",class:"list-anchor",children:"#"})]}),"\n"]}),"\n",(0,l.jsx)(n.hr,{}),"\n",(0,l.jsx)(n.h3,{id:"js-handle-json-value",children:"jsonValue"}),"\n",(0,l.jsx)("font",{size:"2",style:{position:"relative",top:"-20px"},children:"Added before v1.9"}),"\n",(0,l.jsx)("x-search",{children:"jsHandle.jsonValue"}),"\n",(0,l.jsxs)(n.p,{children:["Returns a JSON representation of the object. If the object has a ",(0,l.jsx)(n.code,{children:"toJSON"})," function, it ",(0,l.jsx)(n.strong,{children:"will not be called"}),"."]}),"\n",(0,l.jsx)(n.admonition,{type:"note",children:(0,l.jsx)(n.p,{children:"The method will return an empty JSON object if the referenced object is not stringifiable. It will throw an error if the object has circular references."})}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"Usage"})}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-js",children:"await jsHandle.jsonValue();\n"})}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.strong,{children:"Returns"})}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:[(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise",title:"Promise",children:"Promise"}),"<",(0,l.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Description",title:"Serializable",children:"Serializable"}),">",(0,l.jsx)("a",{"aria-hidden":"true",tabIndex:"-1",class:"list-anchor-link",id:"js-handle-json-value-return"}),(0,l.jsx)("a",{href:"#js-handle-json-value-return",class:"list-anchor",children:"#"})]}),"\n"]})]})}function h(e={}){let{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(c,{...e})}):c(e)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.