Forum Discussion

Jeb's avatar
Jeb
Occasional Contributor
4 years ago
Solved

Can we use regular expressions other than (*) with browser URLs on page's name mapping url

I am trying to automate a country specific site with similar web elements on different sites.

 

Currently I am using * as a wild card to reuse the same scripts across multiple pages which also consolidates the elements of multiple pages into one page.

For example if I use https://siteName*.com/*  to wildcard on the below URLs, I am getting the about page's objects getting mapped to the home page. Can I define a separation between the two using any other approach such as REGEX.

 

stage home -> https://siteName.stg.xyz.com/

stage about-> https://siteName.stg.xyz.com/about

 

  • What I've found as best practice is to NOT wildcard the specific page.  If part of the URL changes (such as .stg.xyz) you can wildcard that.  However, if you want to keep "home" and "about" separate, the second wildcard is not only unnecessary, I would consider it not a best practice.

     

    As for using RegEx... it depends upon how you are using the URL and where.  If you're talking about using it within the NameMapping panel as the property value for URL... then no, I don't believe RegEx is allowed there.

     

    Note that NameMapping ALSO has the options for "conditional"; mapping where you can, effectively, use And/Or logic in properties and property values to distinguish one from another.  Try expanding upon different NameMapping techniques to give you what you want.

7 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    What I've found as best practice is to NOT wildcard the specific page.  If part of the URL changes (such as .stg.xyz) you can wildcard that.  However, if you want to keep "home" and "about" separate, the second wildcard is not only unnecessary, I would consider it not a best practice.

     

    As for using RegEx... it depends upon how you are using the URL and where.  If you're talking about using it within the NameMapping panel as the property value for URL... then no, I don't believe RegEx is allowed there.

     

    Note that NameMapping ALSO has the options for "conditional"; mapping where you can, effectively, use And/Or logic in properties and property values to distinguish one from another.  Try expanding upon different NameMapping techniques to give you what you want.