Forum Moderators: open

Message Too Old, No Replies

Capturing processed information

Capture processed information

         

bnwllr

4:34 pm on Jun 3, 2005 (gmt 0)

10+ Year Member



Hi,

I'm after a way to capture any user information processed on a page - ie. form fields completed, links / buttons pressed etc.

I have a test suite for a bunch of web pages, and am looking to build a 'recorder' to help create new tests. I want this to work by turning the recorder on, and then physically visiting the site, completing any forms as appropriate and then leaving the page using a link / button. I then want a popup window to display all my actions that I completed on that page(which I can wrap in the correct syntax for my tests) so I can just copy & paste them into a test file. The test syntax is generally link(name='thisLink').click, or text_field(id='1234').set('this field') etc. So I need to identify a (unique) section (name, id etc) and a field for forms (1234 etc).

I (ideally) want only form fields which I have altered to be identified, not all fields - as there is no point my tests completing a field with the default of the page.

Any help / advice on the best way to go about this is very much appreciated.

Many thanks,
Ben

Rambo Tribble

1:26 pm on Jun 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just create an array or arrays of your form elements with getElementsByTagName(), then loop through testing for defaultValue, as in something like:

if(frm_elems[0].value!=frm_elems[0].defaultValue){
//add this element value to new array
}

bnwllr

8:18 am on Jun 6, 2005 (gmt 0)

10+ Year Member



Cheers Rambo,

So that would help me with the form fields, but is there a quick / easy way to tell which button / link is pressed too?

Also, some form fields / buttons have some javascript validation already (ie. email check etc) - is this going to cause problems at all?

Many thanks,
Ben

Rambo Tribble

1:01 pm on Jun 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In DOM 2-compatible browsers, like Mozilla, et. al, the target property of the event object reveals the node object that is the subject of the event. In IE the srcElement property serves the same function.

It is hard to say whether this will have any effect on your existing scripts, but it is unlikely.