TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Playwright's getByRole is 1.5x slower than CSS selectors

1 pointsby ilyazubover 1 year ago

1 comment

ilyazubover 1 year ago
I recently wrote a blog post where I take a deep look into Playwright’s locators, specifically comparing the Page#getByRole locator with CSS selectors in terms of performance.<p>Playwright’s getByRole is 1.5x slower than CSS selectors because Page#getByRole uses querySelectorAll(&#x27;*&#x27;) and matches elements by the accessible name.<p>The post breaks down how `getByRole` works under the hood, how it stacks up against CSS selectors performance-wise, and what this means for your testing suites.<p>Would love to hear your thoughts!