Forum Discussion

Vaccanoll's avatar
Vaccanoll
New Contributor
8 years ago

Can't run custom JQuery

I am looking for ways around Named Mapping.  I thought maybe I can get the elements I need to interact with via JQuery.   At first I did this, to make sure that scripts are working:   page.conten...
  • tristaanogre's avatar
    8 years ago

    If you want to get around using NameMapping, I guess JQuery is one way although I don't have any particular experience with it within TestComplete.  Keep in mind that TestComplete's editor is not a web page... it utilizes the JavaScript engine on your workstation to execute the JavaScript code, but that does not mean that everything you can do within a development environment for developing web pages will execute.  What I'm trying to say is that there's no guarentee that JQuery will work within the context of TestComplete.

     

    There are ways around NameMapping.  Look up the methods of "Find" or "FindChild" or "NativeWebObject.Find" or other such things.  I personally use a hybrid where some segments of my application undertest are mapped but for a variety of situtations I opt to use the "Find" methods to find the child objects and return them to my script code.  I know some folks build out their own fully fledged POM style structure where NOTHING is mapped and everything is referenced dynamically in the automation code.  

     

    If you check out the answer I gave to your other post (https://community.smartbear.com/t5/TestComplete-Functional-Web/Make-Named-Mapping-not-care-about-the-quot-Path-quot/m-p/150019) there is a solution to your particular problem with NameMapping.  The key, as mentioned, is understanding how NameMapping actually works... it searches the children of a parent object for a match based upon properties and it does that chaining down a whole tree.  Extended Find allows you to "compress" the tree to allow for variability in the inconsequential "DIV" panels that developers add and is a really powerful way of making your namemapping more robust.