SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    Apprentice
    Join Date
    Oct 2001
    Location
    Denver, Colorado, USA
    Posts
    17
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    building a object dynamically in QTP

    I am trying to build a browser object so that I can check differnt properties of the object for many different types. The problem is that when I start to build the borwser object I get errors because what appears to be an issue with instantiation and the object at runtime.

    This works:

    editObj - the object I am looking for on the page.

    Browser("Desktop Application").Page("Main Page").WebElement(editObj).CheckProperty("innertex t", micRegExpMatch(regX))


    I want to be able to pass in the WebElement or object type and its name like this:

    pageObject = WebElement "(" + editObj + ")"

    Browser("Desktop Application").Page("Main Page").pageObject.CheckProperty("innertext", micRegExpMatch(regX))

    The problem is that I get a Expected end of statment because pageObject looks like a string. I need to instantiate a WebElement I believe and then pass in the name attribute editObj. I don't know how to do this currently and could use some help.

    The big win for this implementation would mean than I can take any object and check them on the fly. Any help would be great and if you have an alternative that would be great too.

    Thanks

  2. #2
    Member
    Join Date
    Oct 2008
    Location
    Cambs, UK
    Posts
    426
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: building a object dynamically in QTP

    You could try looking at the code of my DP script generator:

    http://www.intellipro.co.uk/auto/GenDpV15.htm

    The way it identifies the objects could help with your problem.
    For an easy to use test automation framework, checkout my website:

    http://www.atomqa.com

  3. #3
    Apprentice
    Join Date
    Dec 2008
    Posts
    47
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: building a object dynamically in QTP

    Hi,
    Here is the answer

    execute("Browser(""Desktop Application"").Page(""Main Page"").WebElement(""&editObj &"").CheckProperty(""innertext"", micRegExpMatch(regX))")

    I haven't tried this..but I am sure that you need to use execute function and make sure that when string gets evaluated object name should be quoted.

 

 

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 11:11 AM.

Copyright BetaSoft Inc.