SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 7 of 7
  1. #1
    Senior Member
    Join Date
    Mar 2009
    Posts
    102
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    How to reference a Parent using child object

    Hi,

    Few lines from my application:

    Sys.Process("ProcessName").Dialog("DialogName").Wi ndow("pbdw115", "", 1).Edit("FirstEdit")

    Sys.Process("ProcessName").Dialog("DialogName").Wi ndow("pbdw115", "", 1).Edit("SecondEdit")

    Sys.Process("ProcessName").Dialog("DialogName").Wi ndow("pbdw115", "", 1).Button("FirstButton")



    To reference the first object I am using below code:
    Set FirstEditObj = Sys.Process("ProcessName").Dialog("DialogName").Fi nd("Caption","FirstEdit",2)

    Now to reference the second object I need to write below code:
    Set SecondEditObj = Sys.Process("ProcessName").Dialog("DialogName").Fi nd("Caption","SecondEdit",2)

    Is there any way by which I can create a object of the immediate parent and use that. For example the immediate parent of FirstEdit is Window("pbdw115", "", 1). I want to create a reference to this parent so for others I need not create objects rather I can directly use
    ParentObj.Edit("SecondEdit")...or
    ParentObj.Button("FirstButton").

    Out of the above code
    Sys.Process("ProcessName").Dialog("DialogName").Wi ndow("pbdw115", "", 1).Edit("FirstEdit")
    only Window("pbdw115", "", 1) is dynamic and may change at second run but rest of the path remains same. This is why I am using .Find before Window("pbdw115", "", 1).
    Since Window("pbdw115", "", 1) is dynamic and may change at run time so I can not hardcode this object and want to create it at run time.

    Any help please ?
    Best Regards,
    SAutomation
    Automation Test Analyst

  2. #2
    Senior Member
    Join Date
    Jan 2010
    Location
    Poznań, Poland
    Posts
    188
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to reference a Parent using child object

    If Window("pbdw115", "", 1) is dynamic then maybe try to use a wildcard e.g.:

    Window("pbdw*", "", 1)

    and then you don't have to use slow Find() method.

    As for finding a parent maybe you can use "Parent" property of an object ?


    Sys.Process("ProcessName").Dialog("DialogName").Wi ndow("pbdw115", "", 1).Edit("FirstEdit").Parent
    regards,
    Lukasz Morawski, QA Engineer
    Cognifide testing blog
    PTaQ

  3. #3
    Senior Member
    Join Date
    Mar 2009
    Posts
    102
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to reference a Parent using child object

    Wild card can not work in this case as Window("pbdw115", "", 1) can have any name. Its not just 115 but the number 1 can also change.
    I will check with the .Parent method.

    Thanks for your help.
    Best Regards,
    SAutomation
    Automation Test Analyst

  4. #4
    Senior Member
    Join Date
    Aug 2006
    Posts
    1,920
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to reference a Parent using child object

    Hi,

    Also, you can map objects of your application and make TC address the needed ones directly via Extended Find without using their parents. This way, you'll be able to ignore the dynamic Window("pbdw115", "", 1) object.

    See the "Name Mapping" and "Using Extended Search Criteria for Mapped Object Identification" help topics.
    Jared - AQA Support

  5. #5
    Senior Member
    Join Date
    Mar 2009
    Posts
    102
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to reference a Parent using child object

    I am not using Name Mapping anywhere in my tests. Rather I am using Caption property of objects to identify them as this is unique to almost all the objects in my application in any individual hierarhy/ path.

    .Parent is fine but it just returns the Parent and not the complete path upto Parent.

    Is there any method/property which returns complete Parent Path ?
    Best Regards,
    SAutomation
    Automation Test Analyst

  6. #6
    Senior Member
    Join Date
    Aug 2006
    Posts
    1,920
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to reference a Parent using child object

    Hi,

    I'm not sure what you mean by "complete Parent Path", but if you need the parent's full name, use its FullName property.
    Jared - AQA Support

  7. #7
    Senior Member
    Join Date
    Jan 2010
    Location
    Poznań, Poland
    Posts
    188
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to reference a Parent using child object

    My advice to you is to use object inspector or object browser and explore you window properties.
    regards,
    Lukasz Morawski, QA Engineer
    Cognifide testing blog
    PTaQ

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 04:16 PM.

Copyright BetaSoft Inc.