Page 1 of 2 12 LastLast
Results 1 to 20 of 24

Thread: Regular Expression in QTP

  1. #1
    Junior Member
    Join Date
    Mar 2007
    Answers
    1

    Smile Regular Expression in QTP

    hi friends,
    What is Regular expression in QTP,why we use this and where we use this regular expression.
    cheers,
    Radhika.


  2. #2
    Contributing Member
    Join Date
    Feb 2007
    Answers
    48

    Re: Regular Expression in QTP

    Hi,

    Please find the attachment of regular expressions in QTP

    Regards,
    Ganesh

    Attached Files Attached Files

  3. #3
    Junior Member
    Join Date
    Jan 2007
    Answers
    1

    Re: Regular Expression in QTP

    Quote Originally Posted by smganesh View Post
    Hi,

    Please find the attachment of regular expressions in QTP

    Regards,
    Ganesh
    Please don't send such type of document because it is already exist in QTP help


  4. #4
    Contributing Member
    Join Date
    Feb 2007
    Answers
    48

    Re: Regular Expression in QTP

    Hi Jitesh,

    I didn't mean that. Every one has to provide any information from one place or other. Even, you can find everything in QTP help. No need to look in any other place. But the thing is that, it may be difficult to some one to find help on a particular topic.

    Regards,
    Ganesh


  5. #5
    Junior Member
    Join Date
    Mar 2007
    Answers
    1

    Re: Regular Expression in QTP

    Quote Originally Posted by radhika_inala View Post
    hi friends,
    What is Regular expression in QTP,why we use this and where we use this regular expression.
    cheers,
    Radhika.
    Hi Radhika,
    Regular expression is enables to quick test to identify the objects and text strings.we can use regular expression
    1. Defining property values of an object in dialog boxes or programmatic description
    2. parameterizing step
    3. creating check points with varying values

    for example you can use regular expression if you want create text check point on a date string.but displayed date changes according to the correct date. you have to use regular expression for your date and the check point checks the captured text strings matches the expected date format.
    Regular expression is string that capture the complex search phase using special characters *.[],^......etc


  6. #6
    Contributing Member
    Join Date
    Feb 2007
    Answers
    48

    Re: Regular Expression in QTP

    Let us take yahoo! site as an example. Then the script will be something like:

    ===========================================================
    Browser("Yahoo! Mail - The best").Page("Yahoo! Mail - The best").WebEdit("login").Set "TestUser"
    Browser("Yahoo! Mail - The best").Page("Yahoo! Mail - The best").WebEdit("passwd").SetSecure "460205b87f0543"
    Browser("Yahoo! Mail - The best").Page("Yahoo! Mail - The best").WebButton("Sign In").Click
    Browser("Yahoo! Mail - The best").Page("Yahoo! Mail - TestUser@").Link("Addresses").Click
    Browser("Yahoo! Mail - The best").Page("Yahoo! Address Book -").Link("Mail").Click
    Browser("Yahoo! Mail - The best").Page("Yahoo! Mail - TestUser").Sync

    ===========================================================

    Here the page title is continuously changing. but, all titles contain "Yahoo!"

    When ever, you click on any tabs, i.e. (mail, compose, addresses, etc), the page title changes. but, still contains "Yahoo!" as part of the string. in this case, we can use regular expression (while using descriptive programming):

    ================================================================
    Browser("Yahoo! Mail - The best").Page("ClassName:=Page", "title:=Yahoo.*").WebEdit("ClassName:=WebEdit", "Name:=login").Set "TestUser"
    ================================================================

    Last edited by smganesh; 03-22-2007 at 01:57 AM.

  7. #7
    Contributing Member
    Join Date
    Mar 2007
    Answers
    34

    Re: Regular Expression in QTP

    regular expression is nothing but it combines alll the stages fro m which the string goes what i think. it actually encapsulates your entire string through the stages that passed the above exemples of smganesh is actually right way to implement your regular expression


  8. #8
    Expert Member
    Join Date
    Apr 2007
    Answers
    147

    Re: Regular Expression in QTP

    Regular expression helps you identify dynamically changing objects, like some Nos, names, etc... where even the lenght changes


  9. #9
    Moderator
    Join Date
    Sep 2006
    Answers
    920

    Re: Regular Expression in QTP

    Regular expression is nothing but help us to smoothly run our script if there is any change in string which we can't even output.

    If we can output that string it's always better to output the string in table and then where we have to verify that string then parametrized that with output column.

    Regards,
    Brijesh Jain
    ---------------------------------------------------------
    Connect with me on Skype: jainbrijesh
    Google Plus : jainbrijeshji

  10. #10
    Junior Member
    Join Date
    May 2008
    Answers
    1

    Re: Regular Expression in QTP

    hi
    Does anyone know if there are sample exam papers for the HP QuickTest
    Professional Software - what kind of question they ask?

    Thanks.
    Jigar


  11. #11
    Junior Member
    Join Date
    May 2008
    Answers
    2

    Re: Regular Expression in QTP

    Regular expression helps you identify dynamically changing objects, like some Nos, names, etc... where even the lenght changes


  12. #12
    Junior Member
    Join Date
    Jul 2008
    Answers
    1

    Re: Regular Expression in QTP

    Quote Originally Posted by smganesh View Post
    Let us take yahoo! site as an example. Then the script will be something like:

    ===========================================================
    Browser("Yahoo! Mail - The best").Page("Yahoo! Mail - The best").WebEdit("login").Set "TestUser"
    Browser("Yahoo! Mail - The best").Page("Yahoo! Mail - The best").WebEdit("passwd").SetSecure "460205b87f0543"
    Browser("Yahoo! Mail - The best").Page("Yahoo! Mail - The best").WebButton("Sign In").Click
    Browser("Yahoo! Mail - The best").Page("Yahoo! Mail - TestUser@").Link("Addresses").Click
    Browser("Yahoo! Mail - The best").Page("Yahoo! Address Book -").Link("Mail").Click
    Browser("Yahoo! Mail - The best").Page("Yahoo! Mail - TestUser").Sync

    ===========================================================

    Here the page title is continuously changing. but, all titles contain "Yahoo!"

    When ever, you click on any tabs, i.e. (mail, compose, addresses, etc), the page title changes. but, still contains "Yahoo!" as part of the string. in this case, we can use regular expression (while using descriptive programming):

    ================================================================
    Browser("Yahoo! Mail - The best").Page("ClassName:=Page", "title:=Yahoo.*").WebEdit("ClassName:=WebEdit", "Name:=login").Set "TestUser"
    ================================================================
    Thanks,
    This is fine, can you please explain if is there any way to automate the dynamic links (which change very frequently on a web site) using Regex, if possible with an example?
    llike when you search google with keyword "qtp", will get many search results, here I want to click on first 10 links and check whether I am getting the content or not, can this be done?


  13. #13
    Junior Member
    Join Date
    Jun 2008
    Answers
    1

    Re: Regular Expression in QTP

    Hi,

    Can anyone help me how to use regular expressions with more examples?


  14. #14
    Junior Member
    Join Date
    Mar 2009
    Answers
    2

    Re: Regular Expression in QTP

    some times object properties will changing frequently based on input values ...(dynamic objects)
    in that time we can use regular expressions.we can put manually in script or we can put in OR.
    we have no of regular expressions.
    .,*,[xy],[^xy],[x-y],$,?,|,


  15. #15
    Junior Member
    Join Date
    Sep 2008
    Answers
    1

    Re: Regular Expression in QTP

    All right !! this inhancement will we do but where in the page. Shall we replace the all text with the modified line or any particular?


  16. #16
    Junior Member
    Join Date
    Apr 2009
    Answers
    1

    Re: Regular Expression in QTP

    Hi,

    You can see the following snippet for your undestanding.

    Dim regEx, Match, Matches ' Create variable.
    Set regEx = New RegExp ' Create a regular expression.
    regEx.Pattern = patrn ' Set pattern.
    regEx.IgnoreCase = True ' Set case insensitivity.
    regEx.Global = True ' Set global applicability.
    Set Matches = regEx.Execute(strng) ' Execute search.
    For Each Match in Matches ' Iterate Matches collection.
    RetStr = RetStr & "Match found at position "
    RetStr = RetStr & Match.FirstIndex & ". Match Value is '"
    RetStr = RetStr & Match.Value & "'." & vbCRLF
    Next
    RegExpTest = RetStr


  17. #17
    Junior Member
    Join Date
    May 2009
    Answers
    3

    Re: Regular Expression in QTP

    In my JAva Swing application, frame titles were changing dynamically. Suppose that, title is " - Screen [1]". The number in the title string changes in every iteration. And so, QTP was throwing 'Object not found exception' every iteration (In object repository object was record with the title = " - Screen [1]", but in runtime it was becoming " - Screen [2]"). In order to overcome this problem, i used regular expressions for title attibutes of JavaWindow objects. Let me explain steps,
    1. Right click on JavaWindow object in Keyword View and select Object Properties, then Object Properties window is opened.
    2. Select value of the title attribute and click <#>(configure the value) button at the right, then Value Configuration Options Dialog Window is opened
    3. Check the Regular Expressions checkbox, then write your regular expression in the Constant text area and click OK button

    In our example title name was " - Screen [1]" and let me explain how to make regular expression this title string:

    In regular expressions we have to put '\' for special characters (for example [ or ] or - etc.). Use \s for space character, use \d indicating decimal value and use {a, b} where a is the min. number of digits and b is the max.

    Then our regular expression becomes like this:

    \s\-\sScreen\s\[\d{1,2}\] , here this is valid from " - Screen [0]" to " - Screen [99]"

    You can find detailed information about the syntax in QTP help, "regular expression syntax" section.

    i hope this is useful for you...


  18. #18
    Junior Member
    Join Date
    Jun 2009
    Answers
    9

    Re: Regular Expression in QTP

    Dim regEx, Match, Matches ' Create variable.
    Set regEx = New RegExp ' Create a regular expression.
    regEx.Pattern = patrn ' Set pattern.
    regEx.IgnoreCase = True ' Set case insensitivity.
    regEx.Global = True ' Set global applicability.
    Set Matches = regEx.Execute(strng) ' Execute search.
    For Each Match in Matches ' Iterate Matches collection.
    RetStr = RetStr & "Match found at position "
    RetStr = RetStr & Match.FirstIndex & ". Match Value is '"
    RetStr = RetStr & Match.Value & "'." & vbCRLF
    Next


  19. #19
    Junior Member
    Join Date
    Jun 2009
    Answers
    9

    Re: Regular Expression in QTP

    Fax Order No .*


  20. #20
    Junior Member
    Join Date
    Jun 2009
    Answers
    2

    Re: Regular Expression in QTP

    Quote Originally Posted by sanorita View Post
    Hi Radhika,
    Regular expression is enables to quick test to identify the objects and text strings.we can use regular expression
    1. Defining property values of an object in dialog boxes or programmatic description
    2. parameterizing step
    3. creating check points with varying values

    for example you can use regular expression if you want create text check point on a date string.but displayed date changes according to the correct date. you have to use regular expression for your date and the check point checks the captured text strings matches the expected date format.
    Regular expression is string that capture the complex search phase using special characters *.[],^......etc
    Hi,
    Can u give me script for, displayed date changes according to the correct date.


  21.  Sponsored Ads
    Ad


     
Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact