← Back to Discord Forum

BASIC question: count elements in a div

arleneandrewsposted in #help-playwright
Open in Discord

Anyone have the reference for .NET that will count the elements in a div from a form? I simply can't find it, today.

This thread is trying to answer question "How to count the elements in a div from a form in .NET?"

3 replies

I would use an XPath for the nodes desired in a locator, then "locator.CountAsync()"?

I think that @d3333333's on it. I was going to say that you can get the count from any locator https://playwright.dev/dotnet/docs/api/class-locator#locator-count.

If you give it a go with the test generator, I think you can play a bit with this until you get the hang of it.

Related Discord Threads

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.