Forum Discussion

schnellbach_thi's avatar
schnellbach_thi
New Contributor
14 years ago

Unable to find the object error

Hi,



I'm pretty new in test automation and using Test Complete.

I need to use a object that depends on a parameter of my test. 

I created a variable to convert a bit the string I want to use as following:



var myString = aqString.concat(myParam,"_10");



Then I want to build the object using myString


   
Aliases.object1.object2.myString.object4.Select();



Unfortunately, myString used in the object call is not recognized.

Is there a way to do that? a command to convert the string into an object?



Thanks in advance for your help.

Thibault

2 Replies

  • Hi Thibault,



    You can use either JScript's square bracket notation:



    or eval:

    var obj = eval("Aliases.object1.object2." + myString + ".object4");

    obj.Select();
  • Hi Helen,



    Thanks for your answer. Indeed I found out the solution like you first you've given me and it works fine.



    Thibault