--- sidebar_label: ElementHandle --- # ElementHandle class ElementHandle represents an in-page DOM element. #### Signature: ```typescript export declare abstract class ElementHandle extends JSHandle ``` **Extends:** [JSHandle](./puppeteer.jshandle.md)<ElementType> ## Remarks ElementHandles can be created with the [Page.$()](./puppeteer.page._.md) method. ```ts import puppeteer from 'puppeteer'; (async () => { const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto('https://example.com'); const hrefElement = await page.$('a'); await hrefElement.click(); // ... })(); ``` ElementHandle prevents the DOM element from being garbage-collected unless the handle is [disposed](./puppeteer.jshandle.dispose.md). ElementHandles are auto-disposed when their origin frame gets navigated. ElementHandle instances can be used as arguments in [Page.$eval()](./puppeteer.page._eval.md) and [Page.evaluate()](./puppeteer.page.evaluate.md) methods. 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 `` element matching `selector`, the method throws an error. [tap(this)](./puppeteer.elementhandle.tap.md) This method scrolls element into view if needed, and then uses [Touchscreen.tap()](./puppeteer.touchscreen.tap.md) to tap in the center of the element. If the element is detached from DOM, the method throws an error. [toElement(tagName)](./puppeteer.elementhandle.toelement.md) Converts the current handle to the given element type. [touchEnd(this)](./puppeteer.elementhandle.touchend.md) [touchMove(this)](./puppeteer.elementhandle.touchmove.md) [touchStart(this)](./puppeteer.elementhandle.touchstart.md) [type(text, options)](./puppeteer.elementhandle.type.md) Focuses the element, and then sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. To press a special key, like `Control` or `ArrowDown`, use [ElementHandle.press()](./puppeteer.elementhandle.press.md). [uploadFile(this, paths)](./puppeteer.elementhandle.uploadfile.md) Sets the value of an [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) to the given file paths. **Remarks:** This will not validate whether the file paths exists. Also, if a path is relative, then it is resolved against the [current working directory](https://nodejs.org/api/process.html#process_process_cwd). For locals script connecting to remote chrome environments, paths must be absolute. [waitForSelector(selector, options)](./puppeteer.elementhandle.waitforselector.md) Wait for an element matching the given selector to appear in the current element. Unlike [Frame.waitForSelector()](./puppeteer.frame.waitforselector.md), this method does not work across navigations or if the element is detached from DOM.