2008-08-16

QTP RegExp VIDEO - How to click dynamic link?

The present QTP video explains how to click dynamic links, which change their text.
For example, the number of email drafts can vary:
Dynamic links - value changes
QuickTest Professional cannot know in advance which text will be present.

So, how QTP can click such dynamic links?
There are several possible solutions:
  1. We can use QTP Regular Expression to match dynamic link.
  2. We can use QTP DP (Descriptive Programming) in to find the link during run-time.
  3. We can use others properties of the dynamic link to identify it

The present QTP video shows first approach.
The tutorial covers the following:
  • working with QTP Object Repository
  • identification properties of QTP objects
  • QTP RegExp in object's properties
  • how QTP identifies objects in application
  • and others...
QTP RegExp VIDEO - How to click dynamic link?
--
Dmitry Motevich

30 comments:

  1. Hi,

    In this case you have some part of text is fixed and some part is variable...

    How do you deal with some text that is completely dynamic.

    Which reg expression that matches with country names or a random name?

    How to handle such things in QTP?

    Shrini

    ReplyDelete
  2. Now you will need to explain what is "\(\d+\)"
    :)))

    Roman

    ReplyDelete
  3. Do you really think, if you explain to that guy how to solve a problem in details, it will help him?

    Roman

    ReplyDelete
  4. 2Shrini Kulkarni,
    If your links are completely different (for example, they are country names), so you can use others properties to identify Link in Object Repository.

    For example, instead of 'text' property you can use 'Index' or 'Location' propties. Or mayby 'href' if possible, and so on. Also, you can select coordinates, but I wouldn't recommend it :)

    The idea is simple - you should select something unique to identify the object on Web page.

    ReplyDelete
  5. 2Roman,
    At least, I think that this video is more useful that the simple answer for all questions - "RTFM" (Read This F**king Manual) :)

    ReplyDelete
  6. Dmitry...Having knowledge is something..but sharing is Divine..Thank you.

    ReplyDelete
  7. SubZero,
    Thank you!
    I'm glad that you found this video useful.

    ReplyDelete
  8. This does not work if I delete all drafts(zero drafts).does digit d start form 0 or 1

    ReplyDelete
  9. to Anonymous (September 8),

    Exactly! It won't work because the regular expression is
    Drafts (\d+).

    If you want to process all number of Drafts including zero, you can use for example:
    Drafts.*
    or
    (Drafts|Drafts (\d+))
    (do not forget to add backslashes)

    ReplyDelete
  10. Hi Shrini,

    really its very useful video.
    Grate job..

    ~Chethana

    ReplyDelete
  11. Hi Man,

    Really you have done a great job, please continue your service and create more video tutorials in QTP.

    Thanks,
    Prince3105

    ReplyDelete
  12. hi dmitry,

    may be this is simple and silly question..but i need ur help..
    can i know the purpose of webtable in this video.

    ReplyDelete
  13. @sweety,
    Webtable is a table of emails located in 'Inbox', 'Starred', 'Chats', 'Sent Mail' etc

    ReplyDelete
  14. Very good video, helped me a lot
    -Vasu

    ReplyDelete
  15. This help me a lot. Thanks a lot for posting this. Sorin

    ReplyDelete
  16. I tried this for Inbox..Can you tell me how to get the count for Read and unread emails.

    ReplyDelete
  17. Hello

    When running the scrpit fails at IE pop up box my requirment is it has to clik OK .it works fine some times and fails few times .pls help me out from this.

    ReplyDelete
  18. Hi Dimtry,
    You are great buddy :)

    reg
    bijoy

    ReplyDelete
  19. Hi Dmitry,

    Very informative blog. Thanks for all the videos. BTW, how long does it take to make a video. Just curious!!!

    Amit

    ReplyDelete
  20. @Anonymous/Amit (February 20, 2009),
    Very long :)

    ReplyDelete
  21. I've been working with QTP for a while and the dynamic text was something sticky for these few days, but thanks to your video, it's now solved. Thank you :)

    OMO

    ReplyDelete
  22. Hi DMitry,

    I feel the videos that you have posted should have the fast farward feature.

    good job keep it up!!

    ReplyDelete
  23. can u tell me what regular expression i should use for "Inbox(12)" link.And thanku for ur efforts of sharing knowledge excellent way .

    ReplyDelete
  24. Drafts( \(\d+\))?

    ReplyDelete
  25. Hi
    thanks for the video. I try to simulate the steps in the video
    - upto the point where we rename objects, create the webtable and print the number of messages under Drafts

    But in the object property in the frame object, for Name a certain alphanumeric value is set during the first run. During subsequent runs this value seems to be changing, so when I run the script to print the number of messages in Drafts I am getting the following error

    Cannot find the "Drafts (1)" object's parent "Fr1" (class Frame). Verify that parent properties match an object currently displayed in your application.

    This is my script

    Browser("Main").Page("Inbox").Frame("Fr1").Link("Drafts (1)").Click
    rowCount=Browser("Main").Page("Inbox").Frame("Fr1").WebTable("Draft").RowCount
    MsgBox "Row Count = " &rowCount

    ReplyDelete
  26. Hi
    I am a novice trying to learn from your videos. I was trying the scenerio for clicking 'dynamic link'. I created a script following the steps in the video, up to printing the number of messages under Drafts(1). this is how I tested

    1. wrote a script to open google mail, clicked on Drafts(1)(have 1 mail under Drafts). My test ends here

    2. In the object repository for the frame object, I see a value set for Name.

    3. I renamed all the objects, created the webtable, modified script to print the number of entries under Drafts

    4. Re-ran the script and I see the error
    " Cannot find the "Drafts (1)" object's parent "Fr1" (class Frame). Verify that
    parent properties match an object
    currently displayed in your application."

    I realised each time I run the test, the value for Name in frame changed. This is causing the error.

    How do I resolve this? thanks

    ReplyDelete
  27. Cool videos. Just that the speed could be more between steps :)

    ReplyDelete
  28. Hi Dimtry,

    Really superb work ,these videos helped me a lot. Keep going :)

    ReplyDelete