SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Sep 2002
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Using dynamically named controls

    I'm trying to write some test automation for a web application. Each of our clients uses the same ASP/ASPX pages, but based on information read from the database, the final HTML of each page is customized on a per client basis - so for instance, every client has a dropdown control with a caption that says "Location", but the items in that control and the name of the control itself are dynamically generated on a per-client basis.

    I'm trying to write automation that can work equally well on all our clients, and as a result, can't refer to many of our controls by name in my scripts. I've been trying to access the controls by their indices, but have had mixed success. I can find the controls successfully and figure out what their page index is, and once I've done this, use script like
    page.document.all(iControlIndex).InnerText
    to refer to the controls. However, I can't use actions of controls when referring to them using an index. For a given dropdown control,
    page.document.all.ClientOneLocationDropdown.Click ("menu item")

    works fine, but

    page.document.all.(iControlIndex).Click("menu item")

    doesn't work at all. Does anyone have any suggestions for how I can access control actions successfully without specifically referring to them by name?

    Thanks,

    Justin Davis

  2. #2
    Senior Member
    Join Date
    May 2002
    Location
    Las Vegas, NV, USA
    Posts
    499
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Using dynamically named controls

    Hi Justin,

    Please try using the Child method of an object as follows:

    page.document.all.Child(iControlIndex).Click("menu item")

    Btw, if you need to loop through all of the children of an object you can use its ChildCount property and the Child method like this:

    for i = 0 to page.document.all.ChildCount - 1

    Set Control = page.document.all.Child(i)

    'do stuff here with the Control

    next
    Regards,
    Bobby Edgar
    Olagoo.com
    Save on AutomatedQA Products

 

 

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 10:09 AM.

Copyright BetaSoft Inc.