SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Page 1 of 3 123 LastLast
Results 1 to 10 of 23
  1. #1
    Junior Member
    Join Date
    Jun 2006
    Posts
    27
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Variables in dynamic descriptions

    I created the following descriptive programming block, but QTP 9.1 fails to recognize the link name and generates the message:

    Cannot identify the object "[ Link ]" (of class Link). Verify that this object's properties match an object currently displayed in your application.
    Line (19): "Browser("Case Search Page").Page("Case Search Page").Link(linkDesc).Click"

    Block:
    *where csnumVal = the dynamic value for the field csnum

    Set linkDesc = Description.Create()
    linkDesc("innerHTML").Value = csnumVal
    linkDesc("innerText").Value = csnumVal
    linkDesc("outerText").Value = csnumVal

    Browser("Case Search Page").Page("Case Search Page").Link(linkDesc).Click

    The idea here was to pass the value for csnum as var into the dynamic programming decription then pass that to the statement since those properties for the link object change depending on what is entered in the csnum field.

    Can this be done in this manner or am I off base here?

  2. #2
    Moderator
    Join Date
    Jan 2007
    Location
    Pittsburgh, PA
    Posts
    2,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Variables in dynamic descriptions

    Try with this.

    Set linkDesc = Description.Create()
    linkDesc("innerHTML").Value = csnumVal
    linkDesc("innerText").Value = csnumVal
    linkDesc("outerText").Value = csnumVal
    linkDesc("Index").Value = 0

    Msgbox Browser("Case Search Page").Page("Case Search Page").Link(linkDesc).Exist(3)
    Browser("Case Search Page").Page("Case Search Page").Link(linkDesc).HighLight
    Browser("Case Search Page").Page("Case Search Page").Link(linkDesc).Click

  3. #3
    Junior Member
    Join Date
    Jun 2006
    Posts
    27
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Variables in dynamic descriptions


    TReddy,
    I tried your suggestion, but the msgbox returned false.
    I assume that means it couldn't verify that a link with any of those properties exists. The interesting thing about this is if I stop the run prior to failing, the warning msg indicates the values were passed correctly :
    Object's physical description:
    outertext = 7-25009
    Mercury Class = Link
    innertext = 7-25009
    innerhtml = 7-25009
    Index = 0
    *the 7-25009 matches the ro propeties found when viewing with the object spy

  4. #4
    Moderator
    Join Date
    Jan 2007
    Location
    Pittsburgh, PA
    Posts
    2,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Variables in dynamic descriptions

    As an alternative you could try this.

    Set LinkDesc = Description.Create
    LinkDesc("micclass").Value = "Link"

    Set LinkCollection = Browser(".").Page(".").ChildObjects(LinkDesc)

    For i = 0 To LinkCollection.Count-1
    If LinkCollection(i).GetRoProperty("innerText") = csnumVal Then
    LinkCollection(i).Click
    Exit For
    End If
    Next

  5. #5
    Junior Member
    Join Date
    Jun 2006
    Posts
    27
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Variables in dynamic descriptions

    TReddy,
    Thanks for your help and advice. I inserted your code per post #434438 modifying the Browser and Page definitions as needed, but find that the replay simply skips over the for loop apparently not recognizing a link exists with the innerText roProp that matches the csnumVal.

  6. #6
    Moderator
    Join Date
    Jan 2007
    Location
    Pittsburgh, PA
    Posts
    2,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Variables in dynamic descriptions

    If possible add page view source to this thread.

  7. #7
    Junior Member
    Join Date
    Jun 2006
    Posts
    27
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Variables in dynamic descriptions

    Ok I will attach the page as a file.
    Attached Files Attached Files

  8. #8
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: Variables in dynamic descriptions

    I haven't look at the source code but looking at your code only you are doing it wrong

    Set linkDesc = Description.Create()
    linkDesc("innerHTML").Value = csnumVal
    linkDesc("innerText").Value = csnumVal
    linkDesc("outerText").Value = csnumVal
    linkDesc("Index").Value = 0

    You should use only one of the property innerHTML/innerText/outerText. And you are using all of them here which is bound to cause problems. And if the link is recognizable just by the text then i would suggest you to use outerText

  9. #9
    Moderator
    Join Date
    Jan 2007
    Location
    Pittsburgh, PA
    Posts
    2,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Variables in dynamic descriptions

    csnumVal = "07-25009"
    Set Obj = Description.Create
    Obj("name").Value = csnumVal
    If Browser("micclass:=Browser").Page("micclass:=Page" ).Link(Obj).Exist(3) Then
    Browser("micclass:=Browser").Page("micclass:=Page" ).Link(Obj).HighLight
    Browser("micclass:=Browser").Page("micclass:=Page" ).Link(Obj).Click
    Browser("micclass:=Browser").Page("micclass:=Page" ).Sync
    End If

  10. #10
    Junior Member
    Join Date
    Jun 2006
    Posts
    27
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Variables in dynamic descriptions

    Tarun,
    I have since modified the code using only one description for innerHTML

 

 
Page 1 of 3 123 LastLast

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.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 05:02 PM.

Copyright BetaSoft Inc.