QTP RegExp VIDEO - How to click dynamic link?

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:

Shrini Kulkarni said...

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

Anonymous said...

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

Roman

Anonymous said...

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

Roman

Dmitry Motevich said...

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.

Dmitry Motevich said...

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

Anonymous said...

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

Dmitry Motevich said...

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

Anonymous said...

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

Dmitry Motevich said...

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)

Anonymous said...

Hi Shrini,

really its very useful video.
Grate job..

~Chethana

Prince3105 said...

Hi Man,

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

Thanks,
Prince3105

pranu said...

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.

Dmitry Motevich said...

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

Jaggu said...

Its too good

-Jegan

Anonymous said...

Very good video, helped me a lot
-Vasu

Anonymous said...

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

Anonymous said...

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

naveen said...

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.

Anonymous said...

Hi Dimtry,
You are great buddy :)

reg
bijoy

Anonymous said...

Hi Dmitry,

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

Amit

Dmitry Motevich said...

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

Anonymous said...

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

ram said...

Nice work

Rao said...

Hi DMitry,

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

good job keep it up!!

Anonymous said...

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

Anonymous said...

Drafts( \(\d+\))?

novice said...

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

NeedHelp said...

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

Anonymous said...

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

Anonymous said...

Hi Dimtry,

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