SPONSORS:






User Tag List

Results 1 to 9 of 9
  1. #1
    wsh
    wsh is offline
    Junior Member
    Join Date
    Jun 2001
    Location
    Downers Grove, IL, USA
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Handling dynamic text without using tags

    Hello all,

    Does anyone know how to handle dynamic text within a table whereby all the tags can be different each time. In other words, I need to grab a dynamic text object in a table and save it as a variable, but depending on the circumstances the index, window ID, prior text, caption, and location can be different or non existent alltogether each time the test is run. I appreciate any ideas anyone has. Thanks!

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

  2. #2
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Handling dynamic text without using tags

    Need more info. Does your text always exists in the table.

    if yes:
    reference the text by column and row. Use GetRowText(i)

    if no: you need some fancy stuff to grab it. Either by knowing a reference point then use prior text, or by parsing the GetChildren() values or GetPageSource().


    When all fails run...

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

  3. #3
    Member
    Join Date
    Jun 2001
    Location
    Berkeley, CA, USA
    Posts
    67
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Handling dynamic text without using tags

    If you know what the text value should be, or what the first few characters are, you can use a STRING variable for the window tag.

    Set the tag variable right before you reference the text field.

    STRING sTag

    HtmlTextField Example
    tag sTag




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

  4. #4
    wsh
    wsh is offline
    Junior Member
    Join Date
    Jun 2001
    Location
    Downers Grove, IL, USA
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Handling dynamic text without using tags

    So in answer to the question, the text is not always there. Also, if it is there at all it can be one of two specific strings of text. How do I use the string variable that Bruce mentioned if there are two possible strings that it can be. Also, GodKnows, can you elaborate a little more on the fancy stuff you have to do to grab it. I am done running now and guess I should get back to my problem . Thanks!

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

  5. #5
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Handling dynamic text without using tags

    If your text appears always in a specific cell of the table then just do:

    BrowserPage.HtmlTable().HtmlColumn.GetRowText(i) //this will return the text in a cell.
    You can run other function to do something else. What do you want to do with it?

    If you table size changes according to your text that appears, then you need to find a pattern. It can be the pattern of the window ID for that text. Or in which cell does it appears. If you know in advance what are the texts:

    list of window lsChild=GetChildren()
    int 1,d=ListCount(lsChild)

    for (i=1; i<=d;i++)
    if(MatchStr("text","{lsChild[i]}"))
    break

    //n is never big so run-time is O(1) quiet fast.

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

  6. #6
    wsh
    wsh is offline
    Junior Member
    Join Date
    Jun 2001
    Location
    Downers Grove, IL, USA
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Handling dynamic text without using tags

    The text will always appear in the same cell of the table, fortunately. As I said before, it can be one of two strings of text, or neither. I just need to get the text in the cell and then in my results file, I need to print out the appropriate message/error, depending on what appeared in the cell. Thanks for the help!

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

  7. #7
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Handling dynamic text without using tags

    So just do BrowserPage.HtmlTable().HtmlColumn().GetRowText(i)

    to get the content of that cell.

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

  8. #8
    Member
    Join Date
    Jun 2001
    Location
    Berkeley, CA, USA
    Posts
    67
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Handling dynamic text without using tags

    In order to use a variable as a tag, you set the value of sTag before you access the control.

    For example, if you expect the text caption to be "Test Value" you set sTag = "Test Value"

    Since you say there is a third possibility where you don't know what the tag could be, you could use a select statement to set the value of the tag.

    STRING sVal1 = "Expected Value One"
    STRING sVal2 = "Expected Value Two"
    STRING sIndex = "{Index value of control}"

    select

    case Control(sVal1).bExists

    Print("First value found")
    sTag = sVal1

    case Control(sVal2).bExists

    Print("Second value found")
    sTag = sVal2

    default

    Print("Unexpected value found")
    sTag = Control(sIndex).sValue


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


    [This message has been edited by Bruce Cummins (edited 07-10-2001).]

  9. #9
    wsh
    wsh is offline
    Junior Member
    Join Date
    Jun 2001
    Location
    Downers Grove, IL, USA
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Handling dynamic text without using tags

    Thanks to God and Bruce for the replies. It turns out that GetRowText has done the trick. Until next time....talk to you later

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

 

 

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 07:32 AM.

Copyright BetaSoft Inc.