Forum Discussion

Naureen's avatar
Naureen
New Contributor
7 years ago
Solved

One testcase for two different URLS

Is it possible to design one test case that test a web applications against two different urls depending on  which url user navigates to? I am working on creating some keyword test but I want to use ...
  • kevin_kapell's avatar
    7 years ago

    1. Avoid using object properties that include the URL

    2. If you need to have this then you can use the wild card astrix to replace the part that is different between the URLs.

    Example, change

    https://qasite.yourcompany.com/index to

    https://*.yourcompany.com/index

     

    When opening the site you can put the URL in a project variable.

     

    Here is an example of code we use

     

      Browsers.Item(btIExplorer).Run();
      var browser = Sys.Browser("*");
      var Page1 = browser.Page("*");
      Page1.Wait();
      Sys["Browser"]("*")["BrowserWindow"](0)["Maximize"]();

      var TestSiteURL = Project["Variables"]["SiteURL"];
      Browsers.CurrentBrowser.Navigate("https://"+TestSiteURL);