Cocksure
Cocksure

Reputation: 235

How would one monitor JavaScript execution in a web browser programmatically?

I would like to be able to know when arbitrary JavaScript successfully executes a command in a web browser. The medium doesn't matter, it could be a log, stack trace, event signal, it just has to be something that can be programmatically analyzed.

I've thought about this problem for some time now and I have not been able to come up with an adequate solution. I'm no expert with JavaScript though, so I'm wondering what ideas you have?

Since you'll probably be wondering why, it's just something I'm very interested in.

Any input is appreciated. Can you help me?

EDIT: I've investigated using something like Firebug to monitor JavaScript functions, however I wasn't able to determine if Firebug can be run programmatically on a simulated Web Browser (like a web-browser control in ASP.NET, which is what I'm currently using.) Does anyone know if it can?

Upvotes: 1

Views: 1842

Answers (2)

Zeshan Khan
Zeshan Khan

Reputation: 294

The firefox browser could be used in asp .net using the selenium web driver and it also provide the ability to access all details from a web page. see the document and download api code and integrate it in your project its very easy to integrate using its help. http://docs.seleniumhq.org/projects/webdriver/

Upvotes: 2

Syed Ali Taqi
Syed Ali Taqi

Reputation: 4974

You can use the profiler of Firebug.

Go to the console tab and click Profile. The profiler starts and all the javascript actions are "logged" till you click Profile again. Then you get the list of javascript functions that were executed in this interval.

A similar feature is available in most modern browsers' consoles.

Source: See/Log which javascript function is being executed by the browser

Upvotes: 2

Related Questions