Forum Discussion

mesg2anil's avatar
mesg2anil
Regular Contributor
15 years ago

Calling any URL throughout the script

Hi,



I have a query on how to call a URL through the script?

For example: If i'm writting the script using www.yahoo.com and the script pass the script, if I want to run the same script using www.hotmail.com I will have to modify the whole script with www.hotmail.com whereever I used www.yahoo.com, if I want to make it general script where I can use any URL once and dont have to change the code for each time I use different URL???



Can you please suggest me with idea or with the script, it will be really great.

14 Replies

  • Hello Anil,


    I guess, you need to enable the "Make Page object a child of the browser process" option in your TestComplete project. To get to the option, right-click your project in the Project Explorer panel and select the Edit | Properties context menu item. In the ensuing editor, go to the Open Applications | Web Testing options group. Once you select it, you should see the "Make Page object a child of the browser process" check box.

  • mesg2anil's avatar
    mesg2anil
    Regular Contributor
    Hi Irene,



    Thank you for the reply...

    I check the properties of the Open Application, the option "Make Page object a child of the browser process" is already checked.



    PLEASE HELP ME WITH THE CODE!!! PLEASE!!!!
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    You have several problems with your code.



    First, you're not "dimming" your variables so scope is rather messed up.

    Secondly, you're not returning any value for your function so any calls to the function simply execute the function and don't return anything.



    I modified your code and came up with the following.



    Function page(URL)





    Set page = Sys.Process("iexplore").Page("*")

    Call page.ToURL(URL)

    Call page.Wait





    End Function





    sub tester

    dim PageObj

    Call TestedApps.iexplore.Run

    Set PageObj = page("http://server1/login.asp")

    PageObj.document.all.Item("txtLoginId").Value = "UID"

    PageObj.document.all.Item("txtPassword").Value = "Pwd"

    PageObj.document.all.Item("cmbLogin").Click





    end sub



  • mesg2anil's avatar
    mesg2anil
    Regular Contributor
    Hi Robert...



    THANK YOU VERY MUCH...!! :) Its working now.



    Thank you Jared / Irene!!