Geeks With Blogs

News QTP and Stuff
Theo Moore Questions... Morphology? Longevity? Incept dates?

I am using some of the code I listed earlier in my blog to open and get the hwnd of some browser/page objects. However, one of the other automation engineers found an issue with my code. Apparently, the code had trouble opening a url like http://groups.google.com/grphp?. So, I began to work on it. QTP was returning the ever-useful “General Error“ error, so I had to sleuth this out for myself. I am using this construct in my code to get at the handle:

If Browser(“hwnd:=“ & strBrowser).Page(“url:=“ & oIE.Document.url).Exist(0) then

     strPage = Browser(“hwnd:=“ & strBrowser).Page(“url:=“ & oIE.Document.url).GetROProperty(“hwnd“)

End If

Now, the co-worker was getting the aforementioned General Error (i.e., I am broke and not smart enough to tell you why) on the line inside the If. So, descriptive programming worked fine to get in there. However, when it got to the line inside, it didn't. I added some code to place a “\“ in front of the ? the co-worker passed (to indicate that the ? should be treated literally), and it works fine. I modified the code I now use to look for this issue and correct it without direction.

My only issue is: why the heck did it work fine on the Exist line, but not the GetROProperty line?

Lesson learned: be mindful of regular expressions in your descriptive programming.

 

Join me at:

SC Code Camp 2.0

 

Posted on Wednesday, May 10, 2006 2:40 PM | Back to top


Comments on this post: QTP: Regular expressions and Descriptive Programming

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...
This is becaus descriptive programming does not work properly with check points... even i am not sure how of the solution for this
Left by Balaji on May 17, 2006 2:52 AM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...
Fortunately, placing the "\" in the expression (i.e., "url:=http://groups.google.com/grphp\?" ) works fine. MIC can't seem to give me an explanation of why, though they agree that this difference in behaviour makes little sense.

Theo
Left by Theo Moore on May 17, 2006 4:11 AM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...
Hi

I want to use regulare expression for a frame name identification in Object repositor which can chage in this order:
best *** ways to do
eg:
best hkj eretrt ertert ways to do
best sd ways to do
best rer wer ways to do

i want to use regular expression to match
*** where it can be a single word or more than 1 words.

any suggestions?

where ** can be
Left by arpita on Aug 25, 2006 5:53 AM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...
Try out this...
.*ways to do.*

Thats how we use it in our project.
Left by Unknown on Dec 13, 2006 11:04 AM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...
Try this

strr = ".*"&"ways to do"&".*"
browser().page().frame().object.settoproperty"text",strr

while doing this make sure to change text property of object to regular expression.
Left by milind bhatkar on Dec 26, 2006 6:54 AM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...
how can i check the email address using regular expression?
Left by seethapathi on May 08, 2007 6:23 AM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...
I need How to use regular expression in Descriptive Programme in QTP
Left by chaitanya on May 20, 2007 8:54 AM

# Doubt on using regular expression at run time
Requesting Gravatar...
When we use regular expression for a particular property, say "text" property, we go to object repository and check the regular expression check box (qtp 9.0 and above). Then we use the settoproperty method for that particular property.

My query is that, is there any way to check the regular expression checkbox in object repository for a particular property at run time if it is not checked in object repository ?
Left by Prabeen Pradhan on Aug 29, 2007 3:53 AM

# Doubt on using regular expression at run time
Requesting Gravatar...
When we use regular expression for a particular property, say "text" property, we go to object repository and check the regular expression check box (qtp 9.0 and above). Then we use the settoproperty method for that particular property.

My query is that, is there any way to check the regular expression checkbox in object repository for a particular property at run time if it is not checked in object repository ?
Left by Prabeen Pradhan on Aug 29, 2007 3:53 AM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...

("title:=WCO 2.2.2 Related Customs Duties.*")

Hi Arpita,

you can use Regular Expression like that here in the last i used as (.* ) by using like u can match titels or any words
Left by anji on Sep 03, 2007 7:17 AM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...

("title:=WCO 2.2.2 Related Customs Duties.*")

Hi Arpita,

you can use Regular Expression like that here in the last i used as (.* ) by using like u can match titels or any words
Left by anji on Sep 03, 2007 7:17 AM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...

("title:=WCO 2.2.2 Related Customs Duties.*")

Hi Arpita,

you can use Regular Expression like that here in the last i used as (.* ) by using like u can match titels or any words
Left by anji on Sep 03, 2007 7:17 AM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...

("title:=WCO 2.2.2 Related Customs Duties.*")

Hi Arpita,

you can use Regular Expression like that here in the last i used as (.* ) by using like u can match titels or any words
Left by anji on Sep 03, 2007 7:17 AM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...

("title:=WCO 2.2.2 Related Customs Duties.*")

Hi Arpita,

you can use Regular Expression like that here in the last i used as (.* ) by using like u can match titels or any words
Left by anji on Sep 03, 2007 7:17 AM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...
I m recording a script n that time it takes generates code as
"Browser("Exact e-Synergy - msudhanshu").Page("Exact e-Synergy - msudhanshu").Frame("Products").Link("HRM").Click"
I want that browser should not be static , if next time the value of browser hase been changed i.e. "Exact abc" and i play the same script it should start the application again accepting the changed browser title.. How to use regex here or any other solution.. Please reply ASAP.. Thanks.
Left by Sudhanshu on Sep 19, 2007 1:53 PM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...
Hi folks,
can anybody say the usage of SetTOProperty with an example?
Left by Kirubakaran on Nov 27, 2007 4:07 AM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...
In a treecontrol I want to select a mode which has its initial 5 characters stable and the remain keep varying. Is there any way in which i can check only the first 5 characters of that node and ignore the rest?
e.g A buddy in yahoo contact list "Venkat(busy)" i want a way to ignore the status part of the buddy name and identify that buddy using the constant part even if the keeps changing. Currently my script fails if he changes his status...plz help
Left by Mundu on Dec 05, 2007 2:25 AM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...
In a treecontrol I want to select a mode which has its initial 5 characters stable and the remain keep varying. Is there any way in which i can check only the first 5 characters of that node and ignore the rest?
e.g A buddy in yahoo contact list "Venkat(busy)" i want a way to ignore the status part of the buddy name and identify that buddy using the constant part even if the keeps changing. Currently my script fails if he changes his status...plz help
Left by Mundu on Dec 05, 2007 2:25 AM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...
HAI FRIENDS I AM FRESHER IN QTP AND I WANT TO JOIN IN UR BLOGS
Left by suresh on Dec 11, 2007 4:29 AM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...
HAI FRIENDS I AM FRESHER IN QTP AND I WANT TO JOIN IN UR BLOGS
Left by suresh on Dec 11, 2007 4:29 AM

# re: QTP: Regular expressions
Requesting Gravatar...
hi
i am fresher in qtp.
i am getting this error "cannot identify the object "fax order no.273" (of class dialog).verify that this object's properties match an object currently displayed in your application.
can any one give me the solution for this error

Left by siva on Jan 19, 2008 4:01 AM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...
cxvxvcvxcvwerwerwerwerdfsdf
s dfsfdfsdfsdfsd ds
Left by vxcssdfsdfsfsfs on Feb 04, 2008 5:08 AM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...
cxvxvcvxcvwerwerwerwerdfsdf
s dfsfdfsdfsdfsd ds
Left by vxcssdfsdfsfsfs on Feb 04, 2008 5:08 AM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...
how to open the google page with out recording option.
i need to write the descriptive program
Left by sameer on Feb 20, 2008 12:33 AM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...
hi sameer.
u can type script as systemutil.run "http://www.google.co.in/"

u wil get google page
Left by mahendar on Mar 06, 2008 3:55 AM

# re: QTP: Regular expressions and Descriptive Programming
Requesting Gravatar...
Hi sudhanshu,

Regarding your question about changing Browser name, you can use regular expression to match the browser name as "Exact .*"
Left by pari on May 02, 2008 1:09 PM

Comments have been closed on this topic.
Copyright © Theo Moore | Powered by: GeeksWithBlogs.net