SPONSORS:






User Tag List

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

    How to Find Object Class programatically

    For List Box, class is WebList, for Edit Box, class is WebEdit.
    I would like to know, how to identify the Class of any Object in QTP programmatically in expert view

  2. #2
    Senior Member
    Join Date
    Oct 2003
    Location
    Kyiv, Ukraine
    Posts
    302
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to Find Object Class programatically

    1. by ChildObjects method
    set dpWebEdit = description.create
    dpWebEdit("html tag") = "INPUT"
    dpWebEdit("type") = "text"

    set collWebEdit = Browser(...).Page(...).ChildObjects(dpWebEdit)

    for each WebEdit in collWebEdit
    WebEdit.Set "any text"
    next

    2. by the native method: GetElementsByTagName for the Page test object:
    set collWebEdit = Browser(...).Page(...).Object.GetElementsByTagName ("INPUT")
    for i = 0 to collWebEdit.length - 1
    collWebEdit(i).Set "Any Text"
    next

  3. #3
    Junior Member
    Join Date
    May 2005
    Location
    India
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to Find Object Class programatically

    Thanks for reply....
    By yhis way, we can find out list of objects matching given "html tag"

    Is it possible to find "class" of any object by specifying its logical name

  4. #4
    Senior Member
    Join Date
    Oct 2003
    Location
    Kyiv, Ukraine
    Posts
    302
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to Find Object Class programatically

    oops...
    as far as i know there is no way to find "class" of any object working directly with its logical name;
    but getting "html tag" might be the solution you are looking for:
    a = Browser(...).Page(...).WebEdit(...).GetTOProperty( "html tag")
    Select case a
    case "INPUT" theClass = "WebEdit"
    case "A" theClass = "Link"
    case "SELECT" theClass = "WebList"
    End Select

    suitable?

  5. #5
    Member
    Join Date
    Nov 2004
    Location
    Torrance, CA
    Posts
    64
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to Find Object Class programatically

    We have tried to get a solution for finding an objects class from its logical name but haven't had any luck either!

  6. #6
    Senior Member
    Join Date
    Apr 2001
    Posts
    210
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to Find Object Class programatically

    TestObject("abc").GetTOProperty("MicClass")
    -Dima

  7. #7
    Member
    Join Date
    Nov 2004
    Location
    Torrance, CA
    Posts
    64
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to Find Object Class programatically

    You realize the fundamental flaw in this solution I hope [img]images/icons/smile.gif[/img] "TestObject" already is a reflection of the objects class....
    In essence your asking a question thats already got the answer imbedded in the question itself.

  8. #8
    Senior Member
    Join Date
    Apr 2001
    Posts
    210
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to Find Object Class programatically

    Flint,
    What you say is true, unless you receive the TestObject as a parameter of a function or as a variable. For example:
    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">Set Desc = Description.Create
    Set Chld = Dialog(&quot;Login&quot.ChildObjects(Desc)
    For i = 0 To Chld.Count-1
    MsgBox Chld(i).GetTOProperty(&quot;MicClass&quot
    Next</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">-Dima
    -Dima

  9. #9
    Member
    Join Date
    Nov 2004
    Location
    Torrance, CA
    Posts
    64
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to Find Object Class programatically

    Good idea if the Micclass property worked in that context, which it doesn't and Mercury is not willing to fix it because they are adding another property thats similar to micclass in QTP9.0. This issue confirmed in .NET Windows not sure about other environments, we haven't really tried to use spreadsheets to drive tests other than with this .NET project.

 

 

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.00%
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 03:54 AM.

Copyright BetaSoft Inc.