<titledata-rh="true">Locator class | 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.locator"><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="Locator class | Puppeteer"><metadata-rh="true"name="description"content="Locators describe a strategy of locating objects and performing an action on them. If the action fails because the object is not ready for the action, the whole operation is retried. Various preconditions for a successful action are checked automatically."><metadata-rh="true"property="og:description"content="Locators describe a strategy of locating objects and performing an action on them. If the action fails because the object is not ready for the action, the whole operation is retried. Various preconditions for a successful action are checked automatically."><linkdata-rh="true"rel="icon"href="/img/favicon.ico"><linkdata-rh="true"rel="canonical"href="https://pptr.dev/api/puppeteer.locator"><linkdata-rh="true"rel="alternate"href="https://pptr.dev/api/puppeteer.locator"hreflang="en"><linkdata-rh="true"rel="alternate"href="https://pptr.dev/api/puppeteer.locator"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>Locators describe a strategy of locating objects and performing an action on them. If the action fails because the object is not ready for the action, the whole operation is retried. Various preconditions for a successful action are checked automatically.</p>
<h4class="anchor anchorWithStickyNavbar_FNw8"id="signature">Signature:<ahref="#signature"class="hash-link"aria-label="Direct link to Signature:"title="Direct link to Signature:"></a></h4>
<h2class="anchor anchorWithStickyNavbar_FNw8"id="properties">Properties<ahref="#properties"class="hash-link"aria-label="Direct link to Properties"title="Direct link to Properties"></a></h2>
<table><thead><tr><th><p>Property</p></th><th><p>Modifiers</p></th><th><p>Type</p></th><th><p>Description</p></th></tr></thead><tbody><tr><td><spanid="_">_</span></td><td><p><code>optional</code></p></td><td><p>T</p></td><td><p>Used for nominally typing <ahref="/api/puppeteer.locator">Locator</a>.</p></td></tr><tr><td><spanid="timeout">timeout</span></td><td><p><code>readonly</code></p></td><td><p>number</p></td><td></td></tr></tbody></table>
<h2class="anchor anchorWithStickyNavbar_FNw8"id="methods">Methods<ahref="#methods"class="hash-link"aria-label="Direct link to Methods"title="Direct link to Methods"></a></h2>
<table><thead><tr><th><p>Method</p></th><th><p>Modifiers</p></th><th><p>Description</p></th></tr></thead><tbody><tr><td><spanid="click"><ahref="/api/puppeteer.locator.click">click(this, options)</a></span></td><td></td><td></td></tr><tr><td><spanid="clone"><ahref="/api/puppeteer.locator.clone">clone()</a></span></td><td></td><td><p>Clones the locator.</p></td></tr><tr><td><spanid="fill"><ahref="/api/puppeteer.locator.fill">fill(this, value, options)</a></span></td><td></td><td><p>Fills out the input identified by the locator using the provided value. The type of the input is determined at runtime and the appropriate fill-out method is chosen based on the type. contenteditable, selector, inputs are supported.</p></td></tr><tr><td><spanid="filter"><ahref="/api/puppeteer.locator.filter">filter(predicate)</a></span></td><td></td><td><p>Creates an expectation that is evaluated against located values.</p><p>If the expectations do not match, then the locator will retry.</p></td></tr><tr><td><spanid="hover"><ahref="/api/puppeteer.locator.hover">hover(this, options)</a></span></td><td></td><td></td></tr><tr><td><spanid="map"><ahref="/api/puppeteer.locator.map">map(mapper)</a></span></td><td></td><td><p>Maps the locator using the provided mapper.</p></td></tr><tr><td><spanid="race"><ahref="/api/puppeteer.locator.race">race(locators)</a></span></td><td><p><code>static</code></p></td><td><p>Creates a race between multiple locators but ensures that only a single one acts.</p></td></tr><tr><td><spanid="scroll"><ahref="/api/puppeteer.locator.scroll">scroll(this, options)</a></span></td><td></td><td></td></tr><tr><td><spanid="setensureelementisintheviewport"><ahref="/api/puppeteer.locator.setensureelementisintheviewport">setEnsureElementIsInTheViewport(this, value)</a></span></td><td></td><td></td></tr><tr><td><spanid="settimeout"><ahref="/api/puppeteer.locator.settimeout">setTimeout(timeout)</a></span></td><td></td><td></td></tr><tr><td><spanid="setvisibility"><ahref="/api/puppeteer.locator.setvisibility">setVisibility(this, visibility)</a></span></td><td></td><td></td></tr><tr><td><spanid="setwaitforenabled"><ahref="/api/puppeteer.locator.setwaitforenabled">setWaitForEnabled(this, value)</a></span></td><td></td><td></td></tr><tr><td><spanid="setwaitforstableboundingbox"><ahref="/api/puppeteer.locator.setwaitforstableboundingbox">setWaitForStableBoundingBox(this, value)</a></span></td><td></td><td></td></tr><tr><td><spanid="wait"><ahref="/api/puppeteer.locator.wait">wait(options)</a></span></td><td></td><td><p>Waits for the locator to get the serialized value from the page.</p><p>Note this requires the value to be JSON-serializable.</p></td></tr><tr><td><spanid="waithandle"><ahref="/api/puppeteer.locator.waithandle">waitHandle(options)</a></span></td><td></td><td><p>Waits for the locator to get a handle from the page.</p></td></tr></tbody></table></div></article><navclass="pagination-nav docusaurus-mt-lg"aria-label="Docs pages"><aclass="pagination-nav__link pagination-nav__link--prev"href="/api/puppeteer.launchoptions"><divclass="pagination-nav__sublabel">Previous</div><divclass="pagination-nav__label">LaunchOptions</div></a><aclass="pagination-nav__link pagination-nav__link--next"href="/api/puppeteer.locator.click"><divclass="pagination-nav__sublabel">Next</div><divclass="pagination-nav__label">Locator.click</div></a></nav></div></div><divclass="col col--3"><divclass="tableOfContents_IS5x thin-scrollbar theme-doc-toc-desktop"><ulclass="table-of-contents table-of-contents__left-border"><li><ahref="#properties"class="table-of-contents__link toc-highlight">Properties</a></li><li><ahref="#methods"class="table-of-contents__link toc-highlight">Methods</a></li></ul></div></div></div></div></main></div></div></div><footerclass="footer footer--dark"><divclass="container container-fluid"><divclass="row footer__links"><divclass="col footer__col"><divclass="footer__title">Community</div><ulclass="footer__items clean-list"><liclass="footer__item"><ahref="https://stackoverflow.com/questions/ta