Forum Discussion

praveensqa's avatar
praveensqa
Contributor
13 years ago

VBScriptRuntime error as "Type mismatch:'Window'"

Hi All,




Function oBrowser( )







strhandle = Window("regexpwndclass:=IEFRAME","index:=0").GetROProperty("hwnd")

Set objBrowser=Browser("hwnd:="&strhandle)

Set oBrowser = objBrowser

End Function


I am getting VBScriptRuntime error as "Type mismatch:'Window'"



Can you please give any idea.



Regards,

Praveen

4 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    It looks like you're trying to use QTP script calls within TestComplete.  "Window" is a method off of another object.  Browser isn't even supported.





    To open an instance of your web browser, you should probably use something like TestedApps in your scripts.  So, using that, you're function would look like



    Function oBrowser( ) 

    Set oBrowser = TestedApps.IEXPLORE.Run()

    End Function

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    Hi Praveen,



    In addition to what Robert said, you can access opened web browsers and web pages in the following way:


  • Thanks for replay.

    Hi All,

    My Scenario is :

    Click on Link1: URL:http://1.11.1.1/WebApps/a.do?action=0

    Click on Link2: URL:http://1.11.1.1/WebApps/b.do?action=2

    Click on Link3: URL:http://1.11.1.1/WebApps/c.do?action=3





    In the above case evry time my URL is changing. So i need to acces the forms of respective above pages.









    my idea is to achive above is:





    Set oBrowser = TestedApps.iexplore.Run 

        

    set oPage=Sys.Process("iexplore").Page("Link1 URL") // here error is Unable to find the URL





    oBrowser.oPage.form





    Can you please give some idea to achive the above the scenario


  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    Hi Praveen,



    To load a web page in a browser, you need to use the ToUrl method:



    The Sys.Process(...).Page(...) notation is for web pages that are already opened in a browser.



    By the way, if you recorded your scenario, TestComplete would automatically generate a script with all the needed actions. It's a good, simple way to understand how to write TestComplete scripts for web testing automation.



    I'd also recommend watching our screencasts and webinars about web testing automation -- they will also help you get started and learn some useful tricks:

    Intro to Web Testing With TestComplete

    Verifying Values of Web Page Elements

    Automating Tests of Web Applications

    Creating Reliable Tests For Dynamic Objects with Name Mapping