Considering the following locator: var button = page.Locator("button.some_class")
;
And two ways of getting the count of this locator:
int count = button.CountAsync().Result;
int count = await button.CountAsync();
The result is the same. So that leaves the question when to use which alternative? Hope to get some insight.... With Regards, Aad Slingerland.
This thread is trying to answer question "What is the difference between using .Result and await with asynchronous methods and when should each be used?"
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 [email protected].