SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Jan 2006
    Location
    Argentina
    Posts
    85
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Recognising Objects from a Web by cheking its properties?

    Hello Everyone!
    We have a slight problem here...

    We are using Test Complete to make a QA Application, and scripting in VbScript.
    We need to list every object in the url we are analyzing with this value in the classname propertie: "error".
    Is there any function that tell us which objects have that property in the page, so we could go on with other verifications?

    The problem is that we don't know how to call that objects in order to check the value of their classname propertie, since they are Item(xxx) (where xxx change dinamically depending in the number of objects that are loaded in the page).

    Thank you so much!
    I have made this letter longer than usual, only because I have not had the time to make it shorter.

    Blaise Pascal

  2. #2
    Senior Member
    Join Date
    Oct 2004
    Location
    Las Vegas
    Posts
    473
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Recognising Objects from a Web by cheking its properties?

    Hi,

    I assume that you are using TestComplete 4, please let me know if not.

    To find all the objects with a specific value for a property, you can use the FindAll method. For example:
    [VBScript]
    ...
    Set p = Sys.Process("IEXPLORE")
    fobjects = p.FindAll("className", "error", 1000)
    For i = 0 To UBound(fobjects) - 1
    Log.Message fobjects(i).Name
    Next
    ...

    Please see the 'FindAll Method' help topic for details.

    Atanas

  3. #3
    Member
    Join Date
    Jan 2006
    Location
    Argentina
    Posts
    85
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Recognising Objects from a Web by cheking its properties?

    Yes, we are using Test Complete 4, we will try your solution and let you know the results of this test...

    Thanks in advance!
    I have made this letter longer than usual, only because I have not had the time to make it shorter.

    Blaise Pascal

  4. #4
    Member
    Join Date
    Jan 2006
    Location
    Argentina
    Posts
    85
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Recognising Objects from a Web by cheking its properties?

    Dear Atanas, we tried the function but it seems not to find the objects (we already know they exist).

    After the execution of the program the array fobjects is still empty!

    Also, we cant find the FindAll Method help topic (at least with the advanced search from this page)

    Thanks!
    I have made this letter longer than usual, only because I have not had the time to make it shorter.

    Blaise Pascal

  5. #5
    Senior Member
    Join Date
    Oct 2004
    Location
    Las Vegas
    Posts
    473
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Recognising Objects from a Web by cheking its properties?

    Hi,

    Also, we cant find the FindAll Method help topic (at least with the advanced search from this page)
    <font size="2" face="Verdana, Arial, Helvetica">Are you sure that you have TestComplete 4.0.1321? Can you please check the eaxct version in the 'Help | About' menu.

    After the execution of the program the array fobjects is still empty!
    <font size="2" face="Verdana, Arial, Helvetica">I have specified some sample values for the FindAll method parameters. Only the objects that have an 'error' value for the 'className' property should be found. You probably need to use some other parameters. Also, it is possible that the actual class name in your case is 'Error' (the first letter being capital). The method is case sensitive.

    For example, the following script should return 3 objects:</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">Sub FindAllTest()
    Set p = Sys.Process(&quot;IEXPLORE&quot
    Set w = p.Window(&quot;IEFrame&quot;, &quot;*&quot.Window(&quot;Shell DocObject View&quot.Window(&quot;Internet Explorer_Server&quot
    Call w.ToURL(&quot;http://www.automatedqa.com/&quot;)

    fobjects = p.FindAll(&quot;className&quot;, &quot;productDescription&quot;, 1000)
    For i = 0 To UBound(fobjects) - 1
    Log.Message fobjects(i).Name
    Next

    Log.Message &quot;Item(&quot;&quot;DIV_35&quot;&quot.className = &quot; &amp; w.Page(&quot;*&quot.DIV.Item(&quot;DIV_35&quot.className
    End Sub</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">BTW, please make sure that you have only one instance of Internet Explorer running. Otherwise, the script can get an incorrect instance and therefore will be unable to access the sought for objects.

    Atanas

  6. #6
    Member
    Join Date
    Jan 2006
    Location
    Argentina
    Posts
    85
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Recognising Objects from a Web by cheking its properties?

    With the original code you gave us, finally it worked! We have a problem with the instance, as you said...

    Thank you so much for your help, we really appreciated it!

    Cheers!
    I have made this letter longer than usual, only because I have not had the time to make it shorter.

    Blaise Pascal

 

 

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

Copyright BetaSoft Inc.