Testing the web application with QTP involves the biggest challenge of events bound to the html elements with jquery by developers not getting triggered.
Example -
Problem (Issue)
For instance, when we select the value from the web combobox (dropdown), HTML dom of the webpage changes. It may change the visibility of the some of the controls like edit boxes or drop downs. It may do some ajax calls to the server by using javascript code.
So basically when we do some operation on the web elements , specific event handlers ( java script code or function) get called. But performing the same operation with QTP may not call these event handlers leading to inability to automate the test cases.
Solutions
To handle this issue we can trigger any event like change, click, double click, mouseup, mousedown etc by using FireEvent method. But if it does not work, you can use the vbscript code as depicted below.
'Create the event object
Set evt = Browser("ABC").Page("XYZ").Object.createEvent("HTMLEvents")
'Set the event type like change, click, mouseup, mousedown
evt.initEvent "change", true, true
'Dispatch the event on desired object.
Browser("ABC").Page("XYZ").WebList("pqr").Object.dispatchEvent(evt)
Please give your inputs, suggestions, feedback to Us about above QTP topic. We value your thoughts.