Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Troubles with Regex in Browser
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
I'm having troubles using regular expressions in general actually and I'm not entirely sure why.

Lets say the browser title is ABC. When you go to a different page, it changes to ABC - New Page. I figured I could access the browser with the following:

Code:
Browser("name:=ABC*")
or
Code:
Set bDesc = Description.Create
bDesc("name").value="ABC*"
Browser(bDesc)

Both should work, but they aren't for me.

Does anyone have an idea why?
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
While working with description you need to specify whether the property needs to be treated as reg-ex or not...

Code:
bDesc("name").RegularExpression = True

btw... I think by default all properties of description object are treated as reg-ex ,but just in case, let me know if this worked for you.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
That also did not work. From my understanding, QTP is supposed to treat the values as regular expressions (as you said). I'm not sure why it's not doing so.
Reply
#4
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi

Try this

Code:
Set bDesc = Description.Create
bDesc("name").value="ABC.*"
Browser(bDesc
)

or


Code:
Browser("name:=ABC.*")
Reply
#5
Solved: 11 Years, 3 Months, 3 Weeks ago
That worked. Not sure why I didn't try an actual regular expression. I got to involved with the examples and everyone said you could just use the asterisk. Thanks Smile
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  ReGex not working for Java Items jimrazak 0 2,160 02-23-2012, 06:17 PM
Last Post: jimrazak
  Turn Off RegEx mv8167 4 4,638 09-27-2011, 10:20 PM
Last Post: mv8167
  regex works but how do i return the found string to a variable jove1776 2 3,415 08-24-2011, 06:17 PM
Last Post: jove1776
  QTP 9.2 RegEx issue ashv 2 3,784 02-20-2011, 12:48 PM
Last Post: ashv
  RegEx for a child objects SBsteven 1 3,384 11-17-2009, 11:20 AM
Last Post: v_selvam

Forum Jump:


Users browsing this thread: 1 Guest(s)