SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 6 of 6
  1. #1
    SQA Knight bklabel1's Avatar
    Join Date
    Sep 2012
    Location
    Kew Gardens, United States
    Posts
    2,596
    Post Thanks / Like
    Blog Entries
    1
    Mentioned
    2 Post(s)
    Tagged
    2 Thread(s)
    Total Downloaded
    0

    Creating second half of identifier

    QTP uses the same Browser().Page() all over to recognize the objects.

    want to only pass in the ending part which is usually the object.

    How do I pass the second part of the object description without Browser().Page() in front?

    Code:
    Set TargetObject = .WebElement("descriptive programmig").click  <invalid or unqualified reference)
    
    Call ClickObject(TargetObject)
    
    Function ClickObject(TargetObject)
       With Browser().Page()
             TargetObject.Click
       End With
    End Function

  2. #2
    SQA Knight
    Join Date
    Jun 2008
    Posts
    2,555
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0
    Pass it as a string then concatenate it in your function.

  3. #3
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0
    Well what you are trying is not possible. Because .operator needs a With Statement. And in my personal experience With statements should be avoided. For few lines of code its ok to use but for longer codes, it adds complexity if you want to add if else logics in between. What you can do in this case though is to pass type and object name if you want, Function ClickObject(TargetObjectType, TargetObjectName), you can also pass whole "WebElement(""DP"")" as a string and later use Eval or Execute to translate that into the object

  4. #4
    SQA Knight bklabel1's Avatar
    Join Date
    Sep 2012
    Location
    Kew Gardens, United States
    Posts
    2,596
    Post Thanks / Like
    Blog Entries
    1
    Mentioned
    2 Post(s)
    Tagged
    2 Thread(s)
    Total Downloaded
    0
    @NoUse4Aname..OK on string idea.

    @Tarun...I just learned of this not being possible.

    Thanks,

    Kevin

  5. #5
    Advanced Member
    Join Date
    May 2007
    Posts
    609
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    2 Thread(s)
    Total Downloaded
    0
    One thing I've done in the past is this:
    Set ActivePage = Browser().Page()
    ActivePage.TargetObject.Click

    It isn't exactly what you were looking for but it will save you tiny bit of typing.
    Dennis Belew

  6. #6
    SQA Knight bklabel1's Avatar
    Join Date
    Sep 2012
    Location
    Kew Gardens, United States
    Posts
    2,596
    Post Thanks / Like
    Blog Entries
    1
    Mentioned
    2 Post(s)
    Tagged
    2 Thread(s)
    Total Downloaded
    0
    Dennis,

    On the CallING to the function I was hoping that I could send in only the .Click part as a parameter.

    Inside of the function I know that the application always uses the same Browser().Page(). I could try what NoUse4Aname said, but for now I will pass in the entire identifier string.

    Thanks,

    Kevin

 

 

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 11.54%
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 08:17 AM.

Copyright BetaSoft Inc.