Forum Discussion

akshaya_sharma's avatar
11 years ago

Popup Dialog treated as Unexpected Window

Hi,



I am testing a Desktop application built using C++. In my ATC, I simulate a click on a button which then leads to opening of a Popup Modal Dialog (not a window) and I then post a screenshot of the popup.



The error is coming at the step where I post a screenshot. The test stops showing the errors:


  • "Unexpected Window" (although the screenshot of the popup is attached with this message)


  • "Could not close the unexpected window"


  • "The operation cannot be completed due to an unexpected window." (the screenshot of the entire application is attached with this message).




Additional info:


  1. The popup dialog has been added in the Name Mapping. The identifiers properties used are "ClassName" and "NativeDelphiObject.Name". The "NativeDelphiObject.Name" uses a Wildcard i.e. the value is "TestDialog*" and the original value is "TestDialog_1".


  2. Using Name Mapping or Object Browser, which I click on Highlight Object, I get the error "Cannot highlight this object on screen". But the popup is displayed on the screen.


  3. Using Object Spy, when I select the Popup and click on Highlight Object, it works nicely.


  4. Created an Object Checkpoint (just before the Post Screenshot operation) and checked the ClassName, MappedName, Visible, ObjectIdentifier property and the checkpoint is passed.




Already tried:


  1. I have tried using Extended Find but it didnt help.


  2. Recreating the Name Mapping also didnt help.


  3. Tried using WaitWindow or checking Exists property in a while loop, but both didnt help.


  4. I tried the following script - Log.Picture(Sys.Process("TestApp").VCLObject("TestDialog_1").Picture()); - and executed this instead of Post Screenshot using Run Script Routine but it didnt work. But there's a catch here, when I separated the above line as:




                                               var p = Sys.Process("TestApp");

                                               var o = p.VLCObject("TestDialog_1");

                                               Log.Picture(o.Picture());



             and debugged thru these lines using F11 (Step Into), at that time the routine completed successfully and the Screenshot was                    logged. But when I ran the test without debugging, it failed again with the same error. Perhaps, it worked due to time wait (which              I already tried but failed) or because of the multiple focus/lost focus events that happened every time I pressed F11.



The problem is not only with the Screenshot, after this Step, I have some more operations to be done on the same dialog but all are failing with the same error.



What should I do?









1 Reply

  • ananddave123's avatar
    ananddave123
    Occasional Contributor
    Put a delay of few seconds  here i have specified 5sec if u want to put 10 sec specify 10000



     var p = Sys.Process("TestApp");

    Delay (5000)

      var o = p.VLCObject("TestDialog_1");

        Log.Picture(o.Picture());