SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Sep 2005
    Location
    aus
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    QTP Passing Objects thru multi functions

    Hi,

    I have the following code (simplified):


    Call A (Parent)
    4str = "Set Child = Parent.ChildItem(2,1,"WebList",0)
    Call C (Parent, 4str)

    Function A (Parent)
    1str = "Set 1 = Browser(""Login"").Page(""Hi"")"
    2str = "Set 2 = 1.ChildItem(4,3,""WebTable"",0)"
    3str = "Set Parent = 2.ChildItem(1,2,""WebTable"",0)"
    Execute 1str
    Execute 2str
    Execute 3str
    End Function

    Function C
    Execute 4str
    Child.Select "Hello"
    End Function


    The code fails on the Child.Select resulting in QTP crashing or it says Child cannot use 'Select' (wrong object type, but its a weblist), however the code works with:


    Call A (Parent)
    4str = "Set Child = Parent.ChildItem(2,1,"WebList",0)
    Execute 4str
    Child.Select "Hello"

    Function A (Parent)
    1str = "Set 1 = Browser(""Login"").Page(""Hi"")"
    2str = "Set 2 = 1.ChildItem(4,3,""WebTable"",0)"
    3str = "Set Parent = 2.ChildItem(1,2,""WebTable"",0)"
    Execute 1str
    Execute 2str
    Execute 3str
    End Function

    Is it something to do with passing the objects between multiple functions?
    Any help would be greatly appreciated!
    Thanks
    Luke

  2. #2
    Junior Member
    Join Date
    Sep 2005
    Location
    aus
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: QTP Passing Objects thru multi functions

    Ok, problem solved - apologies

    lies in:
    4str = "Set Child = Parent.ChildItem(2,1,"WebList",0)

    My actual code has '2,1' as 'k,1' and the string took the literal value of k instead of the variable name, fixed with:

    4str = "Set Child = Parent.ChildItem(" & k & ",1,"WebList",0)

    Thanks all

 

 

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 12.50%
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 05:55 PM.

Copyright BetaSoft Inc.