Using regular expression in Elements/Find Element

5 posts, 0 answers
  1. Chris
    Chris avatar
    4 posts
    Member since:
    Jun 2012

    Posted 23 Jan 2013 Link to this post

    Our app has many objects that change ID based on user or sometimes session.
    One of these is a Submit button:
    The numbers that typically get changed are "3664".

    In the Elements list I right clicked and selected Edit Element. 
    Find Element is opened after selecting to locate element without connecting.
    In the ID row I changed "is exactly" to "matches this regular expression"

    ? - Should I just replace "3664" with "*" to except multiple characters within the string like this:
    Can the "?" be used in a string to accept 1 character?  Do I need to insert the wildcards in brackets?

    Find Expressions were also listed in the documentation but their use is a little unclear.

  2. Mario
    Mario avatar
    8 posts

    Posted 28 Jan 2013 Link to this post

    Hello Chris,

    Thank you for your interest in Test Studio and I apologize for the delay in getting back to you on this issue.

    Since your application deals with dynamic ID's on a regular basis, it may be worthwhile to consider solution 1 in this article and demote/remove the id property from being used as the default means for creating an elements' primary find expression.

    If the id's throughout your application are the only unique attribute associated with their respective element, then I hope you will be content with editing the search logic of every element which contains a dynamic portion in its id. Using your example, the find logic should resemble:

    id 'starts with' ctl00_ctl00_mastercontent_ContentPlaceHolder1_MainTemplate1_RadDock
    id 'contains' _C_
    id 'ends with' _btnnewresource_input

    With regards to using 'matches this regular expression', I apologize if our documentation has misled you in any way but 'step 5 - Advanced' in this article contains the only supported operators to be used with that expression. (Note that a * character can only be used at the end of a 'value' to signify a wild card)

    Please let me know whether my suggestion helps or if you have any followup questions.

    Kind regards,
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. Chris
    Chris avatar
    4 posts
    Member since:
    Jun 2012

    Posted 29 Jan 2013 Link to this post

    Thanks for the info.  We'll probably demote the ID for the time being.  Our new architect is seriously looking at more consistent ID's for the GUI objects in the future.
  4. dan
    dan avatar
    28 posts
    Member since:
    Jun 2016

    Posted 01 Sep 2016 in reply to Mario Link to this post

    Hi Mario

    I have an element which can anyone of a series of ids .. advFindEFGRP0FFLD0_filterListFLD, advFindEFGRP0FFLD1_filterListFLD, advFindEFGRP0FFLD2_filterListFLD...


    What would the wildcard be for the regular expression?


    I've tried  id=#advFindEFGRP0FFLD?_filterListFLD




  5. Boyan Boev
    Boyan Boev avatar
    1072 posts

    Posted 06 Sep 2016 Link to this post

    Hello Dan,

    You can try this: 


    It will find every element which ID starts with "advFindEFGRP0FFLD".

    Let me know if that helps.

    Boyan Boev
    Telerik by Progress
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top