The online community for software testing & quality assurance professionals
Calendar   Today's Topics

Lost Password?


Testing Tools >> HP Functional Testing / Mercury QuickTest Pro / QTP

Pages: 1

Reged: 06/02/11
Posts: 23
Loc: India
Object identification technique using jquery
      #719814 - 11/14/12 06:59 PM

I understand in QTP11,there are various object identification techniques like DOM css,xpath for object identification ,question is in the same lines can we use jquery to interact with AUT and perform methods on the objects.A example is given in qtp help but it is very basic,need to know more on using jquery with qtp

I am interested to know about
-as why and when we should go for jquery in qtp by using Embed or Run JavaScripts ?
-If once the javascript is embedded in browser/page ,(A)Can we directly interact with objects ,(B)Will we be able to access objects and apply methods on it, --if so how
-can usage of jquery resolve object identification issues when we test the same working code across fireox,chrome,safari ?
-need some examples on whether object exist,retrieve text in a table,click link,select radio/checkbox in AUT using jquery in qtp
-should we use it Only for the pages built on jquery ?

Post Extras: Print Post   Remind Me!   Notify Moderator  

Reged: 03/06/12
Posts: 232
Re: Object identification technique using jquery [Re: balashankar]
      #719832 - 11/14/12 11:55 PM

Jquery is nothing but a javascript library that u can freely download and embed in your web pages (simplified javascript). So there is nothing like a webpage built over jquery/javascript, it is predominantly a scripting technique employed inside webpages for DOM manipulation, predominantly a developer uses it to raise client side events so the entire form does not have to be posted back to the server (saves server round trip time).
Javascript is the technique to talk to objects on your webpage DOM, CSS, XPath etc and qtp 11 is providing a feature to invoke the same.
If you see the Web add in extensibility guide in qtp you would get more details on how the Standard web methods in qtp are built including Set,Click,Select etc are built over javascript libraries

Post Extras: Print Post   Remind Me!   Notify Moderator  
Junior Member

Reged: 10/13/04
Posts: 3
Re: Object identification technique using jquery [Re: Shreejit]
      #719899 - 11/20/12 02:34 AM


We have experimented using jquery to identify objects, although ultimately we didn't follow this route.

Some background:
Our AUT uses a third-party toolkit that generates complicated, deeply nested pages with hundreds of classes. Our developers have provided us with unique id's to identify top level objects (e.g. grid, combo, tree etc.) and we map these to new classes using jquery in an add-in created by the Extensibility Accelerator. We chose to only use the add-in to identify the top-level objects.

In QTP we have a number of libraries that extend the top-level classes and provide methods for manipulating those objects. These methods use css and occasionally xpath and dom for locating the base html objects from the top-level objects. So for example, the add-in locates the top-level div which represents a combo and our QTP extension library provides a method to set the text using css e.g. <TopLevelObject>.WebElement("css:=input").Set.

For some complex cases We did consider using jquery instead of css/xpath. The idea was to pass to an embedded javascript script the id of the top-level object and locate the base level object we require using the full power of jquery. This works, but I don't think its possible to pass the target object directly back to your script - you can do it indirectly by passing the "html id" back (if there is one!) and creating the object in your script. In the end we found we could do everything with css/xpath/dom, so didn't pursue this technique. Of course, if we had wanted to use jquery it would have been much easier doing it in the add-in in the first place!

Our tests do still call javascript for directly calling the methods of an embedded control, but not for object location. So, nothing needs to be passed back to our script.

Not sure if any of this is any help to you - but just ask if you have any questions.

I think this whole area is poorly documented by HP and there is very little to find online, so I wish you luck finding some answers.

Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1

Extra information
0 registered and 77 anonymous users are browsing this forum.

Moderator:  IanFraser, Rajkumar_Rajangam, thorwath, TReddy, AJ, Tarun Lalwani, mwsrosso 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Topic views: 4868

Rate this topic

Jump to

Contact Us | Privacy statement SQAForums

Powered by UBB.threads™ 6.5.5