Forum Discussion

kalmangt's avatar
kalmangt
Occasional Contributor
9 years ago

Navigate to url with an ip address and port

I am new to Testcomplete and I am trying to get a script that will navigate to a specific web address on our intranet.  The address contains the IP and port so it looks like this:  http://192.168.1.1:7001/website/stuff/etc  I do not want to have the IP and Port and want to use wildcards for it since it could change.  Below is the script I created:

 

function web_test ()
{
Sys.Process("iexplore").Page("*").NavigateTo("http://*:*/website/stuff/etc");

}

 

But I keep getting a JScript error, the parameter is incorrect.  However it works fine if I replace the *:* with the actual Ip and Port.  

 

Is there anyway to keep the widcards for the IP and Port?????

 

 

2 Replies

  • baxatob's avatar
    baxatob
    Community Hero

    You should navigate only to the exact address. 

     

    Navigate To("http://*:*/website/stuff/etc") sounds like "I want to go to the Some Street, house number 5, apartments 124. But I don't care about the city and the country where it could be" :)

     

    However you can use the wildcards for the name mapping. 

    • Colin_McCrae's avatar
      Colin_McCrae
      Community Hero

      Yep.

       

      baxatob is right.

       

      You can't navigate to "http​://*:*/website/stuff/etc" as it's not a valid URL.

       

      You could have the IP and Port numbers as project level variables and update them as and when they change or via some sort of config file/script. That would work. But you need valid IP and port numbers in there if your site is not DNS'd.