Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Add Functionality to Find Elements in Playwright, passing just one locator #34274

Closed
mmsps opened this issue Jan 9, 2025 · 2 comments

Comments

@mmsps
Copy link

mmsps commented Jan 9, 2025

🚀 Feature Request

I would like to request a new function in Playwright that mimics the behavior of driver.FindElements(By.Id("Id")); in Selenium. This function should allow users to find all elements on a page that match a specified Id and return them as an array of elements.

Example

const paragraphs = await page.FindElements(XPATH or CSS));

This function would be extremely useful for scenarios where we need to interact with multiple elements of the same tag type, such as paragraphs, divs, or any other HTML tags. It would enhance the ability to perform bulk operations on elements and improve the overall efficiency of test scripts.

Motivation

  • Simplifies the process of finding multiple elements by tag name, Id etc.
  • Reduces the need for custom implementations to achieve similar functionality.
  • Aligns Playwright's capabilities more closely with Selenium, making it easier for users transitioning between the two frameworks.
  • Thank you for considering this feature request.
@ltsuda
Copy link
Contributor

ltsuda commented Jan 10, 2025

Please, take a look at this: https://playwright.dev/docs/api/class-locator#locator-all

@Skn0tt
Copy link
Member

Skn0tt commented Jan 10, 2025

Yes, Locator.all is what you're looking for.

@Skn0tt Skn0tt closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants