I'm trying to test using QTP a web app that is using ajax4jsf to implement the ajax features.
QTP doesn't have the ability to recognize when the ajax had finished.
I've read that the web extensibility toolkit that is provided with QTP 9.5 and QTP 10 is the solution for my problem.
However, I can't understand how this can help me: I need to know the ready state of the httpRequest object and continue the test when the state is 'complete'. But I don't know how to reach the httpRequest from the web extensibility toolkit.
Any help would be appreciated.
Ajax – QTP Web extensibilty toolkit and ajax
ajaxqtp
Related Topic
- Javascript – Abort Ajax requests using jQuery
- QTP Web Extensibilty – How to force QTP to stop test execution
- Javascript – jQuery AJAX submit form
- Javascript – jQuery Ajax File Upload
- How could QTP recognize the Web-element
- Javascript – How to make an AJAX call without jQuery
- Javascript – Is Safari on iOS 6 caching $.ajax results
Best Answer
Thank you for your answers.
We did manage to solve our problem using the QTP Extensibilty toolkit: A4j uses a queue of listeners that are awaken before and after ajax (Depending on the type of the listener). In our solution, we implemented a Jscript function for each ajax component (e.g webButton):
1. Initialize a globalVariable to 0
2. registers a new function as a listener of type onafterajax:
Go into a sort of busy-waiting loop:
The function we registered is called when the ajax is finished and changes the globalVariable so the while loop will exit. I know this is ugly, but it works great.
Our only problem is that QTP 10 implements the _util.wait while QTP 9.5 doesn't. Without the wait, the browser will be stuck in an infinite loop and the registered function will never be called. Any solution regarding the implementation of a non busy-waiting wait in Jscript would be most appreciated.