playwright-dotnet icon indicating copy to clipboard operation
playwright-dotnet copied to clipboard

How to set timeout in .net[Question]

Open guodeo opened this issue 3 years ago • 5 comments

On the playwright documentation for node.js, it has documentation, however for the .net application there is no such page... how can I change the default timeout for .net please?

guodeo avatar Jul 26 '22 16:07 guodeo

For now I can see this for timeout in .NET documentation. https://playwright.dev/dotnet/docs/next/api/class-browsercontext#browser-context-set-default-timeout although there are no example code blocks for it

@mxschmitt is there anything we can do to improve this

debs-obrien avatar Jul 29 '22 21:07 debs-obrien

Which timeout do you mean? In Playwright for .NET there are multiple timeouts:

a) the test-runner timeout, depends then on your test-harness, e.g. nunit/mstest etc. b) the timeout of your individual actions, you can pass it manually inside each API call as an option or you call context.SetDefaultTimeout c) the Expect timeout, this is 10 seconds by default, we have a tracking issue to make it configurable: https://github.com/microsoft/playwright-dotnet/issues/2237

mxschmitt avatar Aug 01 '22 09:08 mxschmitt

Thanks Max b) and c) are what I was after. I was a bit confused because there was a dedicated documentation page on timeouts for .js but not for .NET

guodeo avatar Aug 03 '22 10:08 guodeo

We'll keep this issue open to track the progress for adding this dedicated page!

mxschmitt avatar Aug 03 '22 10:08 mxschmitt

@guodeo If we compare it to js, with js there is configuration so the playwright acts a little like a framework and less then a library. My recommendation is to use the appettings.json file to configure the timeout. Of course as a result you have to use Program.cs (And this can be complicated)or Startup.cs (This is my recondition) for example:

image image

ShaharM7 avatar Dec 29 '22 12:12 ShaharM7