Forum Discussion

alevans4's avatar
12 years ago

Create TestComplete Object from DOM Object

Is there any way in  JScript to instantiate a TestComplete object wrapper around a DOM object? 

Typically we search for DOM elements on a webpage using TestComplete's Find family of functions.  What's actually returned from the Find function is some sort of TestComplete object wrapper around the actual object.  What I want is a means to instantiate that wrapper object, passing it an existing DOM object that I've found using other means.

  • Bert,

    I understand your idea, but the answer is no, there is no way to do this.

3 Replies

  • Hi Bert,

    As your found element is an existing DOM element, there should be an existing TestComplete wrapper object for it. You just need to search for it by using TestComplete's means as you normally do (Find or Page.EvaluateXPath) by passing some property or attribute value(s).
  • Bert,

    I understand your idea, but the answer is no, there is no way to do this.

  • Right, except in this case I have a DOM object that I've found using a DOM method like querySelector or getElementsByTagName and not TestComplete's Find.  In the version of TestComplete I'm using (7.5) the DOM methods are faster than Find.  After finding an object using a DOM method I want to then pass it to TestComplete for use.  I was hoping I could do something along the lines of

    var obj = new ActiveXObject("SomeTestCompleteObject");

    and then pass the DOM object I already have to that object rather than look for it again using Find.