Code Monkey home page Code Monkey logo

Comments (8)

Exoow avatar Exoow commented on June 8, 2024

You forgot to put await before the method call. :)

from playwright-dotnet.

mathiasi avatar mathiasi commented on June 8, 2024

Ah I’m sorry it was split for debugging purposes but it is awaited on the next line ☺️

from playwright-dotnet.

Exoow avatar Exoow commented on June 8, 2024

But your code fails on line 73 and you're showing line 51.

from playwright-dotnet.

feiyun0112 avatar feiyun0112 commented on June 8, 2024

Maybe you can try the RunAndWaitForResponseAsync method

https://playwright.dev/dotnet/docs/api/class-page#page-wait-for-response

from playwright-dotnet.

mathiasi avatar mathiasi commented on June 8, 2024

But your code fails on line 73 and you're showing line 51.

I believe that's the inner workings of Playwright. This is the stack trace I'm seeing in the output:

[at Microsoft.Playwright.Core.Waiter.WaitForPromiseAsync[T](Task`1 task, Action dispose) in /_/src/Playwright/Core/Waiter.cs:line 228]
[at Microsoft.Playwright.Core.Frame.WaitForNavigationInternalAsync(Waiter waiter, String url, Func`2 urlFunc, Regex urlRegex, String urlString, Nullable`1 waitUntil) in /_/src/Playwright/Core/Frame.cs:line 271]
[at Microsoft.Playwright.Core.Frame.RunAndWaitForNavigationAsync(Func`1 action, FrameRunAndWaitForNavigationOptions options) in /_/src/Playwright/Core/Frame.cs:line 239]
[at E2E.UI.Test.Pages.BasePages.PropertiesPage.ClickCreateAndPublishButton(String comment, Boolean expectValidationErrorForCommentField) in /home/vsts/work/1/s/services/E2E/E2E.UI.Test/Pages/BasePages/PropertiesPage.cs:line 52]

and line 52 is where the task is awaited.

from playwright-dotnet.

mathiasi avatar mathiasi commented on June 8, 2024

Maybe you can try the RunAndWaitForResponseAsync method

I would like to but I'm interested in the URL where it redirects as it will contain a GUID for a newly created entity. Ideally I would like to use RunAndWaitForResponseAsync and capture the GUID in the response but it is part of the body and I can't access that in RunAndWaitForResponseAsync since it only supports synchronous operations (so can't use IResponse.BodyAsync).

from playwright-dotnet.

mxschmitt avatar mxschmitt commented on June 8, 2024

Would it be possible to provide us a reproduction for the issue you are encountering? Based on the information above it could be caused by a lot of core components Playwrights is using. Having a reproduction is necessary for us to debug this issue further, thanks for your understanding!

from playwright-dotnet.

mathiasi avatar mathiasi commented on June 8, 2024

Unfortunately I don't have a reproduceable example. I did however seem to find a workaround. If I start waiting for the URL before I do the action (click a button) then it seems to be more reliable (at least for now). So I moved line 51 to line 40 and kept the await of the task on line 52.

from playwright-dotnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.