mbalsam
mbalsam

Reputation: 631

How to Redirect Gecko Javascript Console messages to a file?

Is there any way to redirect the javascript console to a file?

I found this link

https://bitbucket.org/geckofx/geckofx-29.0/issues/9/how-to-get-javascript-consolelog-error

but it requires using devtools that im not going to have in the field.

There must be a simple way to redirect to a C# method.

Any help is appreciated.

Upvotes: 4

Views: 928

Answers (1)

Sire
Sire

Reputation: 4348

Capture the ConsoleMessage event and save each row to a file:

geckoWebBrowser.ConsoleMessage += GeckoWebBrowserOnConsoleMessage;

void GeckoWebBrowserOnConsoleMessage(object sender, ConsoleMessageEventArgs e)
{
    AppendToFile(e.Message);
}

Upvotes: 2

Related Questions