Skip to content

Instantly share code, notes, and snippets.

@jimevans
Created October 11, 2021 16:33
Show Gist options
  • Save jimevans/35ec33c0c7c7e0e326743869e4d103e4 to your computer and use it in GitHub Desktop.
Save jimevans/35ec33c0c7c7e0e326743869e4d103e4 to your computer and use it in GitHub Desktop.
Selenium C# JavaScript Console Log monitoring example
IJavaScriptEngine monitor = new JavaScriptEngine(driver);
List<string> consoleMessages = new List<string>();
monitor.JavaScriptConsoleApiCalled += (sender, e) =>
{
Console.WriteLine("Log: {0}", e.MessageContent);
};
await monitor.StartEventMonitoring();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment