<titledata-rh="true">ElementHandle.$$eval() method | Puppeteer</title><metadata-rh="true"name="viewport"content="width=device-width,initial-scale=1"><metadata-rh="true"name="twitter:card"content="summary_large_image"><metadata-rh="true"property="og:url"content="https://pptr.dev/api/puppeteer.elementhandle.__eval"><metadata-rh="true"property="og:locale"content="en"><metadata-rh="true"name="docsearch:language"content="en"><metadata-rh="true"name="docsearch:counter"content="2"><metadata-rh="true"property="og:title"content="ElementHandle.$$eval() method | Puppeteer"><metadata-rh="true"name="description"content="Runs the given function on an array of elements matching the given selector in the current element."><metadata-rh="true"property="og:description"content="Runs the given function on an array of elements matching the given selector in the current element."><linkdata-rh="true"rel="icon"href="/img/favicon.ico"><linkdata-rh="true"rel="canonical"href="https://pptr.dev/api/puppeteer.elementhandle.__eval"><linkdata-rh="true"rel="alternate"href="https://pptr.dev/api/puppeteer.elementhandle.__eval"hreflang="en"><linkdata-rh="true"rel="alternate"href="https://pptr.dev/api/puppeteer.elementhandle.__eval"hreflang="x-default"><linkdata-rh="true"rel="preconnect"href="https://DVKY664LG7-dsn.algolia.net"crossorigin="anonymous"><linkrel="search"type="application/opensearchdescription+xml"title="Puppeteer"href="/opensearch.xml">
<p>Runs the given function on an array of elements matching the given selector in the current element.</p>
<p>If the given function returns a promise, then this method will wait till the promise resolves.</p>
<h4class="anchor anchorWithStickyNavbar_LWe7"id="signature">Signature:<ahref="#signature"class="hash-link"aria-label="Direct link to Signature:"title="Direct link to Signature:"></a></h4>
<h2class="anchor anchorWithStickyNavbar_LWe7"id="parameters">Parameters<ahref="#parameters"class="hash-link"aria-label="Direct link to Parameters"title="Direct link to Parameters"></a></h2>
<table><thead><tr><th>Parameter</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>selector</td><td>Selector</td><td>The selector to query for.</td></tr><tr><td>pageFunction</td><td>Func | string</td><td>The function to be evaluated in the element's page's context. An array of elements matching the given selector will be passed to the function as its first argument.</td></tr><tr><td>args</td><td>Params</td><td>Additional arguments to pass to <code>pageFunction</code>.</td></tr></tbody></table>
<h2class="anchor anchorWithStickyNavbar_LWe7"id="example">Example<ahref="#example"class="hash-link"aria-label="Direct link to Example"title="Direct link to Example"></a></h2>
<p>HTML:</p>
<divclass="language-html codeBlockContainer_Ckt0 theme-code-block"style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><divclass="codeBlockContent_biex"><pretabindex="0"class="prism-code language-html codeBlock_bY9V thin-scrollbar"style="color:#393A34;background-color:#f6f8fa"><codeclass="codeBlockLines_e6Vv"><spanclass="token-line"style="color:#393A34"><spanclass="token tag punctuation"style="color:#393A34"><</span><spanclass="token tag"style="color:#00009f">div</span><spanclass="token tag"style="color:#00009f"></span><spanclass="token tag attr-name"style="color:#00a4db">class</span><spanclass="token tag attr-value punctuation attr-equals"style="color:#393A34">=</span><spanclass="token tag attr-value punctuation"style="color:#393A34">"</span><spanclass="token tag attr-value"style="color:#e3116c">feed</span><spanclass="token tag attr-value punctuation"style="color:#393A34">"</span><spanclass="token tag punctuation"style="color:#393A34">></span><spanclass="token plain"></span><br></span><spanclass="token-line"style="color:#393A34"><spanclass="token plain"></span><spanclass="token tag punctuation"style="color:#393A34"><</span><spanclass="token tag"style="color:#00009f">div</span><spanclass="token tag"style="color:#00009f"></span><spanclass="token tag attr-name"style="color:#00a4db">class</span><spanclass="token tag attr-value punctuation attr-equals"style="color:#393A34">=</span><spanclass="token tag attr-value punctuation"style="color:#393A34">"</span><spanclass="token tag attr-value"style="color:#e3116c">tweet</span><spanclass="token tag attr-value punctuation"style="color:#393A34">"</span><spanclass="token tag punctuation"style="color:#393A34">></span><spanclass="token plain">Hello!</span><spanclass="token tag punctuation"style="color:#393A34"></</span><spanclass="token tag"style="color:#00009f">div</span><spanclass="token tag punctuation"style="color:#393A34">></span><spanclass="token plain"></span><br></span><spanclass="token-line"style="color:#393A34"><spanclass="token plain"></span><spanclass="token tag punctuation"style="color:#393A34"><</span><spanclass="token tag"style="color:#00009f">div</span><spanclass="token tag"style="color:#00009f"></span><spanclass="token tag attr-name"style="color:#00a4db">class</span><spanclass="token tag attr-value punctuation attr-equals"style="color:#393A34">=</span><spanclass="token tag attr-value punctuation"style="color:#393A34">"</span><spanclass="token tag attr-value"style="color:#e3116c">tweet</span><spanclass="token tag attr-value punctuation"style="color:#393A34">"</span><spanclass="token tag punctuation"style="color:#393A34">></span><spanclass="token plain">Hi!</span><spanclass="token tag punctuation"style="color:#393A34"></</span><spanclass="token tag"style="color:#00009f">div</span><spanclass="token tag punctuation"style="color:#393A34">></span><spanclass="token plain"></span><br></span><spanclass="token-line"style="color:#393A34"><spanclass="token plain"></span><spanclass="token tag punctuation"style="color:#393A34"></</span><spanclass="token tag"style="color:#00009f">div</span><spanclass="token tag punctuation"style="color:#393A34">></span><br></span></code></pre><divclass="buttonGroup__atx"><buttontype="button"aria-label="Copy code to clipboard"title="Copy"class="clean-btn"><spanclass="copyButtonIcons_eSgA"aria-hidden="true"><svgviewBox="0 0 24 24"class="copyButtonIcon_y97N"><pathfill="currentColor"d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svgviewBox="0 0 24 24"class="copyButtonSuccessIcon_LjdS"><pathfill="currentColor"d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>