Closed ghost closed 2 years ago
Hi,
Page event error is not working as well. Because exception is caught in catch block itself. Pseudocode:
try{
PlaywrightPage.EvaluateAsync(str);
}
catch
{
Console.writeLine("Exception occurred");
}
this.PlaywrightPage.PageError += (_, exception) =>
{
Console.WriteLine("Uncaught exception at PageError event: " + exception);
};
Output: Exception occured
Can you please confirm that if window.onerror event fires whenever exception occurs on a page launched using playwright? Like this- https://www.tutorialspoint.com/What-is-onerror-Method-in-JavaScript
Context:
Code Snippet
I am trying to capture JS error on Playwright Page using window.onerror event, but window.onerror event is not firing during these JS errors.
Does window.onerror event fires automatically if JS errors occur on a playwright page For example: Pseudo code
Expected Outcome: JS errors captured Exception Occurred
Actual Outcome: Exception Occurred
Follow up Question What are other ways to capture JS errors if we open a page on browser launched using Playwright? (Other than window.onerror() )