The following table shows Puppeteer's equivalents to <ahref="https://www.protractortest.org/#/api?view=ProtractorBy"target="_blank"rel="noopener noreferrer">Protractor By</a>.</p><blockquote><p>For improved reliability and reduced flakiness try our
<strong>Experimental</strong><ahref="https://pptr.dev/guides/locators"target="_blank"rel="noopener noreferrer">Locators API</a></p></blockquote><table><thead><tr><th>By</th><th>Protractor code</th><th>Puppeteer querySelector</th></tr></thead><tbody><tr><td>CSS (Single)</td><td><code>$(by.css('<CSS>'))</code></td><td><code>page.$('<CSS>')</code></td></tr><tr><td>CSS (Multiple)</td><td><code>$$(by.css('<CSS>'))</code></td><td><code>page.$$('<CSS>')</code></td></tr><tr><td>Id</td><td><code>$(by.id('<ID>'))</code></td><td><code>page.$('#<ID>')</code></td></tr><tr><td>CssContainingText</td><td><code>$(by.cssContainingText('<CSS>', '<TEXT>'))</code></td><td><code>page.$('<CSS> ::-p-text(<TEXT>)')</code> `</td></tr><tr><td>DeepCss</td><td><code>$(by.deepCss('<CSS>'))</code></td><td><code>page.$(':scope >>><CSS>')</code></td></tr><tr><td>XPath</td><td><code>$(by.xpath('<XPATH>'))</code></td><td><code>page.$('::-p-xpath(<XPATH>)')</code></td></tr><tr><td>JS</td><td><code>$(by.js('document.querySelector("<CSS>")'))</code></td><td><code>page.evaluateHandle(() => document.querySelector('<CSS>'))</code></td></tr></tbody></table><blockquote><p>For advanced use cases such as Protractor's <code>by.addLocator</code> you can check Puppeteer's <ahref="https://pptr.dev/guides/query-selectors#custom-selectors"target="_blank"rel="noopener noreferrer">Custom selectors</a>.</p></blockquote></div></article><navclass="pagination-nav docusaurus-mt-lg"aria-label="Docs pages"><aclass="pagination-nav__link pagination-nav__link--prev"href="/category/integrations"><divclass="pagination-nav__sublabel">Previous</div><divclass="pagination-nav__label">Integrations</div></a><aclass="pagination-nav__link pagination-nav__link--next"href="/chromium-support"><divclass="pagination-nav__sublabel">Next</div><divclass="pagination-nav__label">Chromium Support</div></a></nav></div></div><divclass="col col--3"><divclass="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ulclass="table-of-contents table-of-contents__left-border"><li><ahref="#getting-started"class="table-of-contents__link toc-highlight">Getting started</a><ul><li><ahref="#options"class="table-of-contents__link toc-highlight">Options</a></li></ul></li><li><ahref="#creating-a-single-test-file"class="table-of-contents__link toc-highlight">Creating a single test file</a><ul><li><ahref="#running-test-server-and-dev-server-at-the-same-time"class="table-of-contents__link toc-highlight">Running test server and dev server at the same time</a></li></ul></li><li><ahref="#contributing"class="table-of-contents__link toc-highlight">Contributing</a><ul><li><ahref="#sandbox"class="table-of-contents__link toc-highlight">Sandbox</a></li><li><ahref="#unit-testing"class="table-of-contents__link toc-highlight">Unit Testing</a></li></ul></li><li><ahref="#migrating-from-protractor"class="table-of-contents__link toc-highlight">Migrating from Protractor</a><ul><li><ahref="#browser"class="table-of-contents__link toc-highlight">Browser</a></li><li><ahref="#query-selectors"class="table-of-contents__link toc-highlight">Query Selectors</a></li></ul></li></ul></div></div></div></div></main></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/tagged/puppeteer"target="_blank"rel="noopener noreferrer"class="footer__link-item">Stack Overflow<svgwidth="13.5"height="13.5"aria-hidden="true"viewBox="0 0 24 24"class="iconExternalLink_nPIU"><pathfill="currentColor"d="M2113v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.0354-6.9777.072.8282.8286.977-7.074.1254.172v