0

I am using jscript for scripting in Testcomplete.

I have a function

function A() {

return someobjReference ; //this variable contains a reference

}

function B()

{

} I need to use the object reference(someobjReference ) in function B().How can i do that?

Thanks !

1 Answer 1

2

The JScript language used in TestComplete is the JavaScript language implementation from Microsoft. You can find a lot of information on JavaScript language in Internet or in printed books.

As for your question, you can do this in the following manner:

function B()
{
  var objRef = A();
  // use objRef, for example:
  // Log.Message(objRef.Name);
}
Sign up to request clarification or add additional context in comments.

4 Comments

thanks! Say if i have 2 references returned in A(). Is it possible to access them in B like: function B() { var temp1= A(ref1); var temp2=A(ref2)} ??
JScript functions return only one value. If you can specify what exactly value you want to get by passing an id or name parameter, you can make the function return different references depending on the parameter.
I have an example here.Can you explain on the basis of that? Sorry am totally new to jscript. function A () { var x= some obj ref ; var y =some obj reference; } function B() { //how can i use the values of x and y here ?? } Thanks a lot!
In your example, the best solution is to use two different functions returning different objects: A1 and A2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.