Forum Discussion

AdamBenoit's avatar
AdamBenoit
Occasional Contributor
13 years ago

OnUnexpectedWindow / List of VBScript functions

Hi all,



This is a 2 part question:


  1. Where can I find a list of available VBScript functions available in TestComplete 8.10.487.7?

  2. When using an "EventControl_OnUnexpectedWindow", there are 3 parameters: Sender, Window and LogParams. What properties are available for these objects?


I have a JS Alert box appear with specific form validation error messages and I need to compare the contents of the alert box with known and expected messages and log the result. Does Sender or Window contain the details of the JS alert?



Thank you in advance.



Adam

10 Replies

  • Hello,

    The answer to your questions, the TestComplete help manual. It's very helpful and gives examples in the supported scripting languages (Help -> Contents).



    In short the parameters are:

    Sender is the event handler control.


    Window is the unexpected window object. This may be your best bet to find the text/caption on the alert box. You can add the follow to find the full name of the unexpected window:

    Log.Message("Unexpected Window: " & Window.FullName)


    LogParams contains the detail and information on the message TC is about to post to the log.

     

    To answer your third question, find that windows property and check if it contains the text you're looking for. If the window object does not contain the text, check the Object Browser in TestComplete while the unexpected window is onscreen. See which object contains the text you're looking for. Then compare using that.



    Cheers,

    Jackson

  • AdamBenoit's avatar
    AdamBenoit
    Occasional Contributor
    Jackson,



    Thank you for the reply. I have looked at the object browser and cannot get the info I need.



    Attached is a screenshot of what I see in the object browser. What I cannot access is "Window("Static", "The following error(s) occurred:"&Chr(10)&"- Name is required."&Chr(10), 2)" as it contains the info I need to compare against.


  • AdamBenoit's avatar
    AdamBenoit
    Occasional Contributor
    When I highlight the object, I get this (attached) and can see the info I need in the WndCaption Property. How do I get to it???
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    In your OnUnexpectedWindow handler, use the "Window.WndCaption" property to record the information you need.
  • AdamBenoit's avatar
    AdamBenoit
    Occasional Contributor
    Robert,



    Nope, that is not the answer. :)



    When I do that, all that is logged is  "Message from webpage" which is the title of the dialog. I need the contents("The following error(s) occurred:- Name is required.")



    Thanks though...



    :)
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Oh, I see it now...



    Window.Window("Static","The following error*", -1).WndCaption.



    My bad... forgot the tree relationship between the window and the text message itself.





    .
  • AdamBenoit's avatar
    AdamBenoit
    Occasional Contributor
    Hey Robert, See the period in the last post of yours? The forum allowed me to edit your post. That is very strange...
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Something for the SmartBear people to look at.  I think posts are editable for a user for a short period after they post... it seems that the editing is allowed for EVERYONE for a short period after post.

  • Hi All,





    Normally, users are allowed to edit only their posts within fifteen minutes. The fact that Adam could modify the post of Robert was due to an error which we have fixed. Thanks Adam for reporting the error.