How to handle the regular expression in descriptive programming.....

3,364 views
Skip to first unread message

venkata koduri

unread,
Jan 6, 2009, 7:00:58 AM1/6/09
to Mercu...@googlegroups.com
I have a scenario like every time i have to click a link which is dynamically changed.
Just imagine like "Inbox (2)" in Gmail or Yahoo mail. I know the regular expression is the solution.
 
How can i hadle  the regular expression in descriptive programming.
 
Pls provide the sample ...........

--
Regards..
Venkat

Kishor Kumar

unread,
Jan 6, 2009, 8:50:44 AM1/6/09
to Mercu...@googlegroups.com
Hi venkat,
 
Simply use .* where the deynamic values or changing.
 
Goto Object Repository .select Inbox object then in Innertext or text property clik on right side ,in the pop up windows just type Inbox.* then check the Regular Expression check box .It will ask you use / in regular expression simply click no.
 
In innertext you will see *.*Inbox.* like this try to highlight the link.
 
 
 
Regards,
Kishore

venkata koduri

unread,
Jan 7, 2009, 12:12:03 AM1/7/09
to Mercu...@googlegroups.com
Hi Kishore,
 
No object repositories in my script. I want Descriptive method.
 
Venkat

Kishor Kumar

unread,
Jan 7, 2009, 1:52:24 AM1/7/09
to Mercu...@googlegroups.com
Hi Venkat
 
use the same as below
browser("b").page("p").frame("f").link("innertext:=Inbox.*").click

venkata koduri

unread,
Jan 7, 2009, 2:09:59 AM1/7/09
to Mercu...@googlegroups.com
Kishore
I tried as u mentioned before. But it is not working.
 
Now I am providing sample scipt. If u r interested pls solve my problem...
 
SystemUtil.Run "IExplore.exe"
Browser("title:=about:blank").page("url:=about:blank").Sync
Browser("title:=about:blank").navigate "www.yahoomail.com"
Browser("title:=Yahoo! Mail: The best web-based email!").page("title:=Yahoo! Mail: The best web-based email!").webedit("name:=login").Set "username"
Browser("title:=Yahoo! Mail: The best web-based email!").page("title:=Yahoo! Mail: The best web-based email!").webedit("name:=passwd").SetSecure "password"
Browser("title:=Yahoo! Mail: The best web-based email!").page("title:=Yahoo! Mail: The best web-based email!").webbutton("name:=Sign In").Click
Browser("title:=.*").page("title:=.*").Sync
Browser("title:=.*").Page("title:=.*").Link("text:=Inbox .*").Click
 
Thanks in advance..
 
Venkat

venkata koduri

unread,
Jan 7, 2009, 2:12:27 AM1/7/09
to Mercu...@googlegroups.com
There are some methods like Test, Execute.... to handle the regular expression in descriptive manner. I don't know how to use those methods.. If any body knows pls help me for my problem..
 
Venkat..


 
Regards..
Venkat



--
Regards..
Venkat

Kishor Kumar

unread,
Jan 8, 2009, 12:22:37 AM1/8/09
to Mercu...@googlegroups.com
Hi Venkat,
Try this.this working from my end.
 
SystemUtil.Run "IExplore.exe", "www.yahoomail.com"

Browser("title:=Yahoo! Mail: The best web-based email!").page("title:=Yahoo! Mail: The best web-based email!").webedit("name:=login").Set "username"
Browser("title:=Yahoo! Mail: The best web-based email!").page("title:=Yahoo! Mail: The best web-based email!").webedit("name:=passwd").SetSecure "password"
Browser("title:=Yahoo! Mail: The best web-based email!").page("title:=Yahoo! Mail: The best web-based email!").webbutton("name:=Sign In").Click
Browser("title:=.*").page("title:=.*").Sync
Browser("title:=.*").Page("title:=.*").Link("text:=Inbox.*","index:=0").Click

saurabh gupta

unread,
Jan 6, 2009, 11:06:32 AM1/6/09
to Mercu...@googlegroups.com
Hi Kishore,

your option will also click on the link like "My Inbox...." or "Go to Inbox...." or anything which contain the word "Inbox". Which i dont thing is tidy and robust option to do.

I would suggest the below:
Use below string......

Inbox\([0-9].*\)

This will just replace the numbers in brackets...
Let me know if it helps.....

All the very best...



On Tue, Jan 6, 2009 at 7:20 PM, Kishor Kumar <kisho...@gmail.com> wrote:



--
Thanks & Regads,
Saurabh Gupta
Technical Associate
Tech Mahindra Ltd. Pune.
Mob. 9881370245

Dmitry Motevich

unread,
Jan 9, 2009, 9:50:25 AM1/9/09
to Mercu...@googlegroups.com
There is QTP video. It can help you:
QTP RegExp VIDEO - How to click dynamic link?
--
Dmitry Motevich,
http://motevich.blogspot.com

venkata koduri

unread,
Jan 10, 2009, 6:25:20 AM1/10/09
to Mercu...@googlegroups.com
Hi Dmitry
 
I don't want to use Object Repository. I want Descriptive Manner.
--
Regards..
Venkat

maddy

unread,
Jan 10, 2009, 7:46:20 AM1/10/09
to QTP - HP Quick Test Professional - Automated Software Testing
'######################################################################################
case:-->If You Know the Link name get Generated in application during
run time (ie, passing data form excel)

set pagobj=Browser("Browser").page("Page")
runtimelinkname=given from excel sheet

call linkclick(pagobj,runtimelinkname)

set pagobj=nothing

'**********************************************************************************************

Function linkclick(pagobj,runtimelinkname)

LnkCount=Trim(pagobj.object.links.length)

For i=0 to LnkCount-1

AllRuntimeLnkName=Trim(pagobj.object.links
(i).innertext)

Res=strcomp(runtimelinkname,AllRuntimeLnkName,1)

If (Res=0) Then

pagobj.object.links(i).click

Exit For

End If


Next

'######################################################################################

Dmitry Motevich

unread,
Jan 11, 2009, 12:25:21 AM1/11/09
to Mercu...@googlegroups.com
Regular Expressions concepts are the same for both Object Repository and Descriptive programming.
Mentioned video explains how to work with Regular Expressions.

You can see this video about working with QTP Descriptive Programming (DP). You will be able to create any DP statement,
QTP Descriptive Programming - QTP video
Reply all
Reply to author
Forward
0 new messages