Forum Discussion

aduddella's avatar
aduddella
Contributor
14 years ago

How to access the pop up windows as a result of click

Hi



Situation



I fill a form and then click the submit button and on the submit a pop up window appears which needs a confirmation



So I have the following code to handle this




function CheckUnexpectedWindow()



Dim p, unexpWnd



Set p = Sys.Process("iexplore",2)


' Handle possible unexpected windowSet unexpWnd = p.WaitWindow("#32770",, -1, 500)


If unexpWnd.Exists Then


' Post the window image to the logCall Log.Picture(unexpWnd.Picture, "Unexpected window detected.")


' Close unexpected windowaqObject.RaiseEvent Project, "OnUnexpectedWindow", "", unexpWnd, ""


'unexpWnd.Close


if unexpWnd.WaitWindow("Button", "OK", -1, 100).Exists then


unexpWnd.Window("Button", "OK", 1).Click()


end if


End If

end function



But once we perform click action the test completes hangs and does not come into this function which is equipped to handle the pop up window



But if you manuall perform a confirm action on the pop up window then test complete resumes



So what i feel is happening is that



Test complete is waiting for a response from the Iexplore process which is waiting for the response from pop up window and its a dead lock situation



Could anyone please send me the solution how to resolve this



Regards

Anand



5 Replies

  • Hi,



    This happens because the modal dialog which appears on your page causes a lock-up. To avoid this, you need to call the method which invokes this dialog asynchronously as it is described in the "Testing Modal Windows" help topic.
  • Dear Jared



    Thank you very much for the help and it sorted my issue .



    I also observed another thing and wanted if you can give me some information on this topic



    After using this method with the following syntax to handle the asynchronous methods


    call Runner.CallObjectMethodAsync(arrObj(i),"Click")


    Auxiliary.CheckUnexpectedWindow






    Initially in arrObj(i) there is an Anchor tag ( an html object) and once the call runner code gets executed the element in arrObj(i) gets emptied



    It still supports the properties such as nodeName,typename() but everything is empty



    I do not want to loose that object after the execution of Call Runner method



    Could you please suggest me any way to do that.



    Thank you in advance for your support



    Regards

    Anand
  • Hi,



    It looks like you cannot access the problematic object because your page is unavailable (it is blocked by the modal dialog which appears). Are you able to access this object after you close your modal window? Also, you can lose object references if your page got refreshed inside the browser. In this case, you need to reobtain them.



    BTW, does this object exist in the Object Browser when its reference stored in the array gets lost?
  • Hi 



    I am able to access the modal window and proceed further but i have a standard click function to which i pass the objects to perform action in an array format 



    in some situation you might encounter a modal window or in some cases no modal windows however for each click operation is perfomed but the same line of code irrespective of the presence of modal window 



    call Runner.CallObjectMethodAsync(arrObj(i),"Click")  



    In in cases where there is no modal window and i just obtain a object on page to perform the click operation 



    I am able to perform the operation but after the operation the object is emptied although still its associated properties are supported but everything is empty 



    Any idea how to avoid this 



    Thanks for quick reply 



    Regards

    Anand
  • Hi,



    It looks like your object gets recreated. Try using the following code:



    objName = arrObj(i).FullName

    call Runner.CallObjectMethodAsync(arrObj(i),"Click")

    ' handle your modal dialog and wait until Click's execution is complete

    Set arrObj(i) = Eval(objName)