microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.41k stars 3.63k forks source link

Page.Console event is not working #15138

Closed mkgn closed 2 years ago

mkgn commented 2 years ago

In one of my test cases, I want to see whether there are any console errors are there. So in my test method I use;

        Page.Console += async (sender, e) => {
                //need to check for e.Type
                scriptErrorCount++;
        };

In my application If I simulate an error, it doesn't get caught in the test case. Am I using this the wrong way?

mxschmitt commented 2 years ago

Most likely its PageError instead: https://playwright.dev/dotnet/docs/api/class-page#page-event-page-error

rwoll commented 2 years ago

Labeling as triage per Max's tip above. Please let us know if that resolves your issue. If not, please share a minimal repro that exhibits the problem (and at least the JavaScript in the page you expect to be generating these messages you are listening for).

Thanks!

rwoll commented 2 years ago

Closing as part of triage due to inactivity and per above tip. Please feel free to re-file and reference this issue if it's still not resolved.