"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[70610],{3905:function(e,t,n){n.d(t,{Zo:function(){return m},kt:function(){return c}});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var d=r.createContext({}),u=function(e){var t=r.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):p(p({},t),e)),n},m=function(e){var t=u(e.components);return r.createElement(d.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},i=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,d=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),i=u(n),c=a,h=i["".concat(d,".").concat(c)]||i[c]||s[c]||l;return n?r.createElement(h,p(p({ref:t},m),{},{components:n})):r.createElement(h,p({ref:t},m))}));function c(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,p=new Array(l);p[0]=i;var o={};for(var d in t)hasOwnProperty.call(t,d)&&(o[d]=t[d]);o.originalType=e,o.mdxType="string"==typeof e?e:a,p[1]=o;for(var u=2;u"," ",(0,l.kt)("a",{parentName:"p",href:"/puppeteer/docs/next/puppeteer"},"puppeteer")," ",">"," ",(0,l.kt)("a",{parentName:"p",href:"/puppeteer/docs/next/puppeteer.elementhandle"},"ElementHandle")),(0,l.kt)("h2",{id:"elementhandle-class"},"ElementHandle class"),(0,l.kt)("p",null,"ElementHandle represents an in-page DOM element."),(0,l.kt)("b",null,"Signature:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-typescript"},"export declare class ElementHandle extends JSHandle \n")),(0,l.kt)("b",null,"Extends:")," [JSHandle](/puppeteer/docs/next/puppeteer.jshandle)",(0,l.kt)("h2",{id:"remarks"},"Remarks"),(0,l.kt)("p",null,"ElementHandles can be created with the ",(0,l.kt)("a",{parentName:"p",href:"/puppeteer/docs/next/puppeteer.page._"},"Page.$()")," method."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-js"},"const puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n const hrefElement = await page.$('a');\n await hrefElement.click();\n // ...\n})();\n")),(0,l.kt)("p",null,"ElementHandle prevents the DOM element from being garbage-collected unless the handle is ",(0,l.kt)("a",{parentName:"p",href:"/puppeteer/docs/next/puppeteer.jshandle.dispose"},"disposed"),". ElementHandles are auto-disposed when their origin frame gets navigated."),(0,l.kt)("p",null,"ElementHandle instances can be used as arguments in ",(0,l.kt)("a",{parentName:"p",href:"/puppeteer/docs/next/puppeteer.page._eval"},"Page.$eval()")," and ",(0,l.kt)("a",{parentName:"p",href:"/puppeteer/docs/next/puppeteer.page.evaluate"},"Page.evaluate()")," methods."),(0,l.kt)("p",null,"If you're using TypeScript, ElementHandle takes a generic argument that denotes the type of element the handle is holding within. For example, if you have a handle to a ",(0,l.kt)("inlineCode",{parentName:"p"},"