views:

40

answers:

2

Hi all!

I'm automating the manual testing of some Web Application.

This app uses a lot number of JavaScript. And I want to know, what scripts executes when I manually clicking some button. Here is the example of button's code:

<button type="button" class="x-btn-text " id="ext-gen525" title="Add Options">Add</button>

This button adds row into table on page using AJAX. As you can see, declaration of this button not contain block "onclick" or something like this. How can I know what script executes on clicking this button?

A: 

You will have to search the javascript file to see where they are adding the event handler. Most of the time people will use

document.getElementById("ext-gen525")

to reference the element they want to add it to. Try searching the .js file for the id "ext-gen525" and you should see the function they are adding to the onclick event.

John
Thank you, I'm doing this now, but app has big number of different js-files (((Maybe exists easier way to do this?
Vitaliy
+3  A: 

The best way to do it is to use Firefox javascript profiler (comes with FireBug) you simply go to the page, wait for it to load completely, activate the profiler, click the button, deactivate the profiler and what you will see is a list of functions that were activated.

Avi Tzurel