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
    Jul 2007
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Capturing InnerText and assigning into a variable

    Hi,
    In automating WebApplication using TP,I hav found an object called HTMLTD.I need to capture the data(I could see data in InnerText field) from that object and put into a variable.Can anyone plz help me in this regard???

  2. #2
    Member
    Join Date
    Feb 2006
    Location
    Gujarat, India
    Posts
    238
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Capturing InnerText and assigning into a variable

    I think you have to Alias map the control to a text box or kind of control it is customised and developed.

    Then it will be easy for you to capture the text of the control and move further.

  3. #3
    Member
    Join Date
    Feb 2007
    Posts
    90
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Capturing InnerText and assigning into a variable

    <font class="small">Code:</font><hr /><pre>dim iText as string
    iText = HTMLTD("[attachname]").innertext</pre><hr />

    The tricky part is creating an attachname that will find a particular THTMLTD when you don't already know the innertext. My preferred techniques:

    1) search for innertext using wildcards (e.g., "innertext='Your reference # is:*'")
    2) search for innertext using the index position (e.g., "index=26")

  4. #4
    Junior Member
    Join Date
    Jul 2007
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Capturing InnerText and assigning into a variable

    Can you plz tell me will the index remain constant in web application?

  5. #5
    Senior Member
    Join Date
    Apr 2003
    Location
    Wisconsin, USA
    Posts
    5,338
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Capturing InnerText and assigning into a variable

    Not from build to build.

  6. #6
    Advanced Member
    Join Date
    Jan 2002
    Location
    Detroit, Michigan
    Posts
    522
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Capturing InnerText and assigning into a variable

    Index is calculated based on the number of controls that are similar and have the same details. Therefore, if a new control of the same type (and properties) is introduced into the application (web page in your instance), all indexes that follow the control will be incremented by 1.
    //*eggbox

  7. #7
    Senior Member
    Join Date
    Sep 2004
    Location
    Toronto, Canada
    Posts
    555
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Capturing InnerText and assigning into a variable

    THTMLTD elements are inan HTML Table, so you should be able to find it based on the row and column position. Usually, these stay constant from build to build if the TD element is part of the general UI. If it is part of a report generated in the program, then the location in the table might change, but it would likely be the same column. Perhaps walking through a table's row would be an option here.

    Aracknid.
    TestPartner:
    Current AUT running test scripts on TP 6.3 build 183, SQL 2000 DB.
    Legacy AUT running on TP 5.6.0 Build 81 and TP 6.2 build 449 with SQL 2000 DB.

    Test Environment:
    TP/IE Clients on VMWare ESX 4.1 server, AUT Servers on VMWare ESX 3.5 server.

    Application Under Test (AUT):
    Client/Server based, IE 7/8 interface with SQL 2005/2008 DB.

    Automating with TP since August 2004.

  8. #8
    Senior Member
    Join Date
    Jun 2007
    Location
    USA
    Posts
    876
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Capturing InnerText and assigning into a variable

    I just solved this with a visual test in TP 6.0

    Record a click on the screen so you can identify from playback.

    Create a Capture Text and attach to the object.

    Insert a Property from Control attaching to the object using the control as InnerText and define it to your local variable

    Do not forget to create the local variable under the Start on the visual test
    "I think when you spread the wealth around, it's good for everybody." -- Toledo, Ohio, Oct. 12, 2008

  9. #9
    Member
    Join Date
    Feb 2007
    Posts
    90
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Capturing InnerText and assigning into a variable

    [ QUOTE ]
    Can you plz tell me will the index remain constant in web application?

    [/ QUOTE ]
    If you load the same web page over and over, the index will remain the same.

    If the web page has dynamic content, or is being changed by developers, probably not.

    I don't like to use indexes for this reason, they are not very robust.

 

 

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

Copyright BetaSoft Inc.