Forum Discussion

GAutomation's avatar
GAutomation
Frequent Contributor
6 years ago

objects is different for a same static page but with different URL

www.webtesting.com/log-in and www. webtesting.com/log-out calls the same static page. but when we name map the objects it is creating 2 different objects for the smae username. how to handle this. 

 

aliases is mapped to browser. But the Mapped objects i see  parents are different. But when we automate in selenium we are able to use a single object for both url.

  • Page identification in name mapping, by default, when recording or manually mapping, uses the URL as one of the properties.  In order to "fix" this, you need to, after you do your intiai recording, edit the mapping of the page so that the URL is more generic.

     

    For example, let's say you have two environments.

     

    https://testenvironone.net/

    https://testenvirontwo.net/

     

    There is a static page for logging in with a path off the url of LoginPage

     

    So, in a browser, you would see

     

    https://testenvironone.net/LoginPage

     

    or

     

    https://testenvirontwo.net/LoginPage

     

    When you record on the first environment, that full URL is include in the mapping of the page.  What you need to do is edit that mapping and replace the URL with

     

    */LoginPage

     

    That will ensure that, no matter what environment you run under, the page will always be found.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Page identification in name mapping, by default, when recording or manually mapping, uses the URL as one of the properties.  In order to "fix" this, you need to, after you do your intiai recording, edit the mapping of the page so that the URL is more generic.

     

    For example, let's say you have two environments.

     

    https://testenvironone.net/

    https://testenvirontwo.net/

     

    There is a static page for logging in with a path off the url of LoginPage

     

    So, in a browser, you would see

     

    https://testenvironone.net/LoginPage

     

    or

     

    https://testenvirontwo.net/LoginPage

     

    When you record on the first environment, that full URL is include in the mapping of the page.  What you need to do is edit that mapping and replace the URL with

     

    */LoginPage

     

    That will ensure that, no matter what environment you run under, the page will always be found.