Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How Can I Use Regular Expression on Tree View Node Object?
12-22-2011, 12:16 AM
Post: #1
How Can I Use Regular Expression on Tree View Node Object?

I'm new to QTP and have been doing very well at figuring things out on my own. However, I have a problem I can't figure out and none of the solutions I'm finding and trying are working. Here's my problem:

I have a script which has a Tree View Node which only displays as "_treeview" in the Object Repository. However, I wrote this code to display the child nodes not displaying in the OR:
**************************************
myNodes = SwfWindow("New Loan").SwfTreeView("_treeView").GetContent

MsgBox myNodes
**************************************
It worked and all the child nodes I was looking for showed up in the MsgBox, including the ones I want to put a Regular Expression On (SEE ATTACHMENT):

Example:
Loan;Contacts;Mister Software Tester;Personal
Loan;Contacts;Mister Software Tester;Employer
etc.

The name (Mister Software Tester) changes on each iteration. Could someone please tell me how to write a Regular Expression to identify this object in the script, eventhough the name (Mister Software Tester) is dynamic. For instance on the next iteration the object name may be:

Loan;Contacts;Misses Tester Lady;Personal
Loan;Contacts;Misses Tester Lady;Personal

Please Help.

Thank you.


Attached File(s)
.doc  Tree View Nodes.doc (Size: 136.5 KB / Downloads: 6)
Find all posts by this user
Quote this message in a reply
12-26-2011, 06:11 PM
Post: #2
RE: How Can I Use Regular Expression on Tree View Node Object?
Hi,

Where do you want to use the regular expression - Code or Object repository?

Object Repository
------------------
Loan;Contacts;[a-zA-z];[a-zA-z]

Code
------
Set RegEx = CreateObject("VBScript.RegExp")

RegEx.Pattern ="^Loan;Contacts;[a-zA-Z];[a-zA-Z]$"

result=RegEx.Test(strText)
If result=True Then
msgbox "Pass"
Else
msgbox "Fail"
End If

Set RegEx=Nothing

Plz check if this helps.

Regards,
Ankesh
Find all posts by this user
Quote this message in a reply
12-26-2011, 07:21 PM
Post: #3
RE: How Can I Use Regular Expression on Tree View Node Object?
Hi

thanks Ankesh





quote='Ankesh' pid='19381' dateline='1324903271']
Hi,

Where do you want to use the regular expression - Code or Object repository?

Object Repository
------------------
Loan;Contacts;[a-zA-z];[a-zA-z]

Code
------
Set RegEx = CreateObject("VBScript.RegExp")

RegEx.Pattern ="^Loan;Contacts;[a-zA-Z];[a-zA-Z]$"

result=RegEx.Test(strText)
If result=True Then
msgbox "Pass"
Else
msgbox "Fail"
End If

Set RegEx=Nothing

Plz check if this helps.

Regards,
Ankesh
[/quote]
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Regular expression for this string falvi 2 216 04-30-2012 11:14 AM
Last Post: falvi
  regular expression rjkmr.aiht 0 129 04-27-2012 11:37 AM
Last Post: rjkmr.aiht
  Regular Expression samverma 3 335 03-31-2012 01:21 AM
Last Post: samverma
  Square Bracket Issue - Regular Expression kapsig431 2 267 03-29-2012 08:38 PM
Last Post: kapsig431
  Regular Expression for time in 24 hour format with out colon Pallavi 3 406 03-13-2012 11:29 AM
Last Post: sshukla12

Forum Jump:


User(s) browsing this thread: 1 Guest(s)