Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regular expression in descriptive programming
#1
Not Solved
I am trying to use regular expression in variable declaration with in a function.

Code:
Function FieldExistOrNot(label)
    Dim flag
    Dim objDescription
    Set objDescription = Description.Create()
    objDescription("ClassName").Value = "WebElement"
    objDescription("innertext").RegularExpression = True
    objDescription("html tag").value ="LABEL"
      objDescription("innertext").value = ".*" &label& ".*"
    MsgBox objDescription("innertext").value
    flag = Browser("Name:=Home Page for.*").page("Title:=Home Page for.*").Frame("title:=Content Check-In.*").WebTable("Text:=Content Check-In.*").WebElement(objDescription).exist

End Function
Above is my script. I have to define innertext value using input parameter label and regular expression.

When it is executed, i am getting the innertext value as ".*label.*"
Reply
#2
Not Solved
If you use .* at the start then the regular expression will exclude anything you have entered after it so QTP would not recognise the innertext properly. If possible then use .* always at the end like :
Code:
"value:=" &label& ".*"
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need Any digit in xpath path using Regular expression Priyam 1 3,238 10-05-2016, 11:05 AM
Last Post: Ankur
  Regular expression to read two words in lowercase, uppercase and with and without spa sarahq49 1 3,185 04-09-2015, 01:56 AM
Last Post: sarahq49
  Regular expression and script optimisation Padmavathy 1 3,600 03-30-2015, 11:46 AM
Last Post: supputuri
  need a regular expression. anu05446 0 2,992 11-26-2014, 03:00 PM
Last Post: anu05446
Rolleyes Help Required : In Understanding the regular expression arescool 0 2,807 08-15-2013, 08:59 AM
Last Post: arescool

Forum Jump:


Users browsing this thread: 1 Guest(s)