Rayrun
← Back to Discord Forum

Is there a fundamental difference between await xyz and xyz.Result ?

aad_aka_2733posted in #help-playwright
Open in Discord
aad_aka_2733
aad_aka_2733

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?"

2 replies

Effectively, one is synchronous one is async...

aad_aka_2733
aad_aka_2733
@dand33: Thank you

Thank you

Related Discord Threads

TwitterGitHubLinkedIn
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.