Results 1 to 8 of 8

Thread: Regular expression is not working.

  1. #1
    Junior Member
    Join Date
    Apr 2008
    Answers
    9

    Regular expression is not working.

    Hi guys

    Need help to solve one issue, I recorded one script 2 months back that time my session name was recorded “2008_0514_xyz”. Now today if I run my script then it throws the error stating “” because today it created session name “2008_0714_xyz”. (months changed)
    how am I supposed to handle this issue?

    I tried to use regular expression (“.*2008_0514_xyz”) but still it is failing.

    my script is: Browser(Browser).page(page_1).linck(“2008_0514_xyz”).click

    Thanks in advance.

    Ema

    Last edited by emaraj; 07-21-2008 at 03:55 PM.

  2. #2
    Expert Member
    Join Date
    Jan 2007
    Answers
    211

    Thumbs up Re: Regular expression is not working.

    Quote Originally Posted by emaraj View Post
    Hi guys

    Need help to solve one issue, I recorded one script 2 months back that time my session name was recorded “2008_0514_xyz”. Now today if I run my script then it throws the error stating “” because today it created session name “2008_0714_xyz”. (months changed)
    how am I supposed to handle this issue?

    I tried to use regular expression (“.*2008_0514_xyz”) but still it is failing.

    my script is: Browser(Browser).page(page_1).linck(“2008_0514_xyz”).click

    Thanks in advance.

    Ema
    Please check the Property of the linck Control, which has the constant string value i.e "2008_0514_xyz", I would suggest to use 2008_0\d{3}_xyz for that property.


    Regards,
    Nawab


  3. #3
    Junior Member
    Join Date
    Apr 2008
    Answers
    9

    Re: Regular expression is not working.

    Quote Originally Posted by NawabShaikh View Post
    Please check the Property of the linck Control, which has the constant string value i.e "2008_0514_xyz", I would suggest to use 2008_0\d{3}_xyz for that property.


    Regards,
    Nawab
    Hi Nawab thanks for your reply i tried as you said but still it is not working. It is throwing error "property mismatch".

    please help me


  4. #4
    Junior Member
    Join Date
    Apr 2008
    Answers
    9

    Re: Regular expression is not working.

    Hi Nawab

    I tried "2008_\([1-12]\)18_xyz" but still it is failling. Please tell me where am i doing mistake?

    Thanks
    Ema


  5. #5
    Expert Member
    Join Date
    Jan 2007
    Answers
    211

    Arrow Re: Regular expression is not working.

    Please ensure that while you make a property as a regular expression, u select the checkbox(regular expression)...hence only in that case the string will parsed as a regular expression in QTP.

    if nothing works then go for *.*

    E.g if there is a string value OSTD_45_T

    and here I am sure that 45 is a variant component....then

    the property of the control that holds the string value , suppose text..

    text = OSTD_\d{2}_T else OSTD_\d{1,}_T else OSTD_*.*_T

    there is a checkbox which ask that u want to nake it a regular expression...just select that...and its done..


    please revert in case there are issues.

    Regards,
    Nawab


  6. #6
    Junior Member
    Join Date
    Apr 2008
    Answers
    9

    Re: Regular expression is not working.

    Hi Nawab

    Thanks for your help but still my script is throwing error of mismatch property.
    I did check the check box.

    Below I am trying to explain my page.

    On my web page, first, I record year '2008' then date from the calendar box '06/18' then program area and hit on the 'Create' button so system generate the session name "2008_0618_xyz". But when I run this script after a month then it is throwing error because month is change. So when I run today then it create the session name '2008_0718_xyz' and match with the existing script which has session name”2008_0618_xyz”. Because month is changed so system throws the error of mismatch property.

    Script is:
    Browser (browser).page (page).link ("2008_0618_xyz").click

    I went to the object property of this line and entered the regular expression; I did check the check box and click 'yes'. I can see the blue color box near the session name on object property box, and then tried to run but still throwing error. I used the regular expression syntax whatever you said to use.

    Can you please help me?

    Thanks
    Ema


  7. #7
    Expert Member
    Join Date
    Jan 2007
    Answers
    211

    Arrow Re: Regular expression is not working.

    Quote Originally Posted by emaraj View Post
    Hi Nawab

    Script is:
    Browser (browser).page (page).link ("2008_0618_xyz").click

    Could you please provide the screenshot of Object Repository & the Control as in ur application.


    Regards,
    Nawab


  8. #8
    Junior Member
    Join Date
    Apr 2008
    Answers
    9

    Re: Regular expression is not working.

    Hi Nawab

    Thanks a lot for you help

    Attaching screen shot.

    Please help me..

    Ema

    Attached Images Attached Images Regular expression is not working.-regular-expression-jpg 
    Last edited by emaraj; 07-24-2008 at 09:09 AM.

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