Forum Discussion

madhavisri01's avatar
madhavisri01
Contributor
14 years ago

Object Recognition Seperation

Hello,



We are planning to separate object recognition from script and maintain them in text file(ini fromat).Similar concept of name mapping but  we are maintaing them in txt .The only problem we have is unable to read #,.*,|,(,),,,"" kind of special characters from window id's.Do you think this will be the better approach or do you suggest any other approach.Could you please help me in reading the below ini format which contains special characters.request you to share the code.



[Mainwindow]

Canvas application =Sys.Process("MyApp").Window("#32770", "Window Caption").Window("MyContainerClass", "", 1).Window("MyPanelClass", "Canvas Panel")

Addbutton =Sys.Process("MyApp").Window("#32770", "Window
Caption").Window("MyContainerClass", "", 1).Window("MyPanelClass",
"Canvas Panel").Window("Button", "Add")

[/]



[Filemenu]





[/]

4 Replies


  • Hello Madhavi,





    How do you read this file?

    Have you tried working with the XML file instead?

    Why does the Name Mapping feature not work for you?
  • Hello David,



    I am planning to read the file as Ini file.I will pass the recognition string to the script something like this in jscripting



    //Data file

    [Mainwindow]

    Canvas application =Sys.Process("MyApp").Window("#32770", "Window
    Caption").Window("MyContainerClass", "", 1).Window("MyPanelClass",
    "Canvas Panel")

    Addbutton =Sys.Process("MyApp").Window("#32770", "Window
    Caption").Window("MyContainerClass", "", 1).Window("MyPanelClass",
    "Canvas Panel").Window("Button", "Add")

    [/]



    if(dReader[Mainwindow].Canavas application).exists==true)

    {

    Log.message("Application exists");

    }

    else

    {

    Log.error("Application is not available");

    }



    Customer is not comfortable with name mapping.They wanted to maintain recognition strings in separate file.Please let me know if this is the right approach and help me with the code.Thanks for your help in advance.





    Madhavisri
  • AlexKaras's avatar
    AlexKaras
    Community Hero
    Hi Madhavisri,



    You should use evaluate(), eval() or the similar function that is supported by your script language to resolve the string obtained from the file into reference to the application object. I.e. :



    if(eval(dReader[Mainwindow].Canavas application)).exists==true)

      ...

  • Hello Madhavi,





    I understand that you want to read an INI file, but you are telling that you have problems reading it and you do not tell how exactly you do this. Please clarify whether you are using a custom script, a special DLL, a .NET assembly, a custom script extension, etc. Without knowing how exactly you try to read a text file, I cannot tell anything about why you have problems doing this.





    Customer is not comfortable with name mapping.They wanted to maintain recognition strings in separate file.Please let me know if this is the right approach and help me with the code.Thanks for your help in advance.
    But why? The Name Mapping feature provides much more convenient and flexible way to work with objects. The way you are trying to follow limits you with the default object names that use a very limited list of identification properties while Name Mapping allows you using any properties to identify an object and, moreover, additional recognition techniques: mapping an object by required children, specifying custom conditional mapping criteria, searching for an object at any levels of hierarchy.





    If want to get rid of long object names, you can remove the intermediate objects from the hierarchy by settings up the Aliases tree in the desired way.





    I think that you just do not understand how the Name Mapping feature is powerful. I recommend that you view the [url=http://www.automatedqa.com/products/testcomplete/screencasts/reliable-tests-for-dynamic-objects/]Creating Reliable Tests For Dynamic Objects with Name Mapping

    [/url] video that should reveal all the pros of this functionality.