SPONSORS:






User Tag List

Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Jun 2000
    Location
    Princeton, NJ
    Posts
    13
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Declaring a list of objects

    I have a child window that has 20+ text fields. I want to access them from a list ex. Window.TextField[5].GetText (). Do I have to declare each of them individually and then add them to a list or is there a way to declare one list of text fields that includes all 20+ fields.

    Thanks.

  2. #2
    Senior Member
    Join Date
    Jun 2000
    Location
    Chicago, IL USA
    Posts
    383
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Declaring a list of objects

    I think I understand what you want.
    Try this code:
    To fill in the data fields the first time, run the test with junk data to generate a verification error. When you highlight the verification error, the menu item "Results" -> "Update Expected Value" will be enabled. This will automatically paste in your test data for a regression test.


    ------------------
    Rob Kapteyn


    [This message has been edited by RobKapteyn (edited 07-25-2001).]
    Rob Kapteyn, CSTE
    RobKapteyn@gmail.com

  3. #3
    Junior Member
    Join Date
    Jun 2000
    Location
    Princeton, NJ
    Posts
    13
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Declaring a list of objects

    Thank you. That would work for creating the list during script execution. I want to actually do this in the window declaration. Right now I have:
    I want to eliminate all the individual TextField declarations. I want to declare all of them as just List of TextField for example.

    Thanks.


  4. #4
    Senior Member
    Join Date
    Nov 2000
    Location
    Bloomington, IL
    Posts
    142
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Declaring a list of objects

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by BlueTester:
    I have a child window that has 20+ text fields. I want to access them from a list ex. Window.TextField[5].GetText (). Do I have to declare each of them individually and then add them to a list or is there a way to declare one list of text fields that includes all 20+ fields.

    Thanks.
    <HR></BLOCKQUOTE>

    Why would you want to do this within a window declaration? I am not sure this is possible anyway.

    Here is a way to do it at runtime to get your list of fields:

    [+] LIST OF WINDOW CheckForClass(DATACLASS dcClass) //Gets the list of objects that match the specified class
    [ ] //************************************************** ***************************************
    [ ] //* This function captures all of the object's and their information on the current screen
    [ ] //* then searches through the stored LIST OF WINDOW for DATACLASS matches equal to the
    [ ] //* input value dcClass. When it finds a class match the object's name is stored in the
    [ ] //* returned LIST OF WINDOW lwMatches. When all of the objects have been gone through
    [ ] //* the values stored in lwMatches is passed back to what called this function
    [ ] //************************************************** ****************************************
    [ ] LIST OF WINDOW lwObjects //Use to store complete list of objects on the active page
    [ ] LIST OF WINDOW lwMatches //Use to store the returned LIST OF WINDOW
    [ ] WINDOW w //Designates the current window
    [ ] WINDOW wObject //Use to store the objects in the lwObjects LIST OF WINDOW
    [ ]
    [ ] w=Browser.GetActive() //Get the active window's name
    [ ] lwObjects = w.GetChildren () //Get a list of all of the objects on the screen
    [+] for each wObject in lwObjects //For every object in the LIST OF WINDOW
    [+] if (ClassOf (wObject) == dcClass) //If the Class of the stored object equals the class passes in
    [ ] ListAppend(lwMatches, wObject) //Append the object to a new LIST OF WINDOW
    [ ]
    [ ] return lwMatches //Return the values in the lwMatches LIST OF WINDOW


    This function captures all instances of the class specified and stores them in a list of string that you can use to process your code.

    Mike


    ------------------

  5. #5
    Senior Member
    Join Date
    Jun 2000
    Location
    Chicago, IL USA
    Posts
    383
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Declaring a list of objects

    "Declaring" things in this way does not make sense with SilkTest. Perhaps you could give an example from another programming language? You can perform operations on groups of Textfields by NOT declaring them, and using their tag index numbers only.

    Example:
    ------------------
    Rob Kapteyn


    [This message has been edited by RobKapteyn (edited 07-25-2001).]
    Rob Kapteyn, CSTE
    RobKapteyn@gmail.com

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin 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 04:15 PM.

Copyright BetaSoft Inc.