Forum Discussion

jkunkel's avatar
jkunkel
New Contributor
15 years ago

How to close a pop up during a test

Hello,



I am new to Test Complete and am not a developer but have been grasping the basics of the program. I am trying to set up automated tests that run on our website by using name mapping. I am having trouble however with a pop up window that appears after a customer would complete their checkout on our website. I need for it to close, so that the next test can begin, however I can't get it to close and then get the error "There is 1 running instance of C:\ProgramFiles\InternetExplorer\IEXPLORE.EXE,New instances will not be launched" so my next test will then fail.



Now, I had the pop up mapped as NameMapping.Sys.iexplore3 but I am guessing that this must be incorrect. I thought about trying to record this part of the test and simply hit the X on the browser but being that this test is fairly generic and will be used on different sites of ours, I would prefer to map the object as I have with everything else. Please help!



Thanks,

Jen

5 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Are you using Script code for your tests or a Keyword test?  I'm assuming as non-developer, you're using Keyword tests.



    If that's the case, what you might want to do is add to the test that is generating the pop-up the "If Object" operation.  Use that operation to test for your popup and, if it exists, click on the appropriate button.
  • jkunkel's avatar
    jkunkel
    New Contributor
    Yes, that is correct - I am using Keyword tests. That is actually how I have it set up:

    If Object - iexplore3 exists, then close.



    Which is why I am unsure if it is mapped incorrectly. I thought that ieexplore2 would be the next tab in the iexplore1 window so 3 would be logical to set as the pop up.



    The object is actually a BizRate survey that appears after the submit button is clicked. It is not on every site which is why I set it up as the If Statement to begin with. It just doesn't seem to recognize it though and I'm not sure why.
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Actually, the number of tabs does not necessarily equal the number of iexplore processes that are generated.  This is variable and is dependent upon CPU, RAM, etc.  So, assuming iexplore3 is your tab that you need to close is not accurate.



    I don't have it RIGHT at my fingertips but there's a thread on the forum up here somewhere that describes a registry edit for TabProcGrowth which will force Internet Explorer to always open as a single process.



    What you need to do instead of closing the process is to actually map the specific page object and buttons/components from that page so you can interact with them.  Take a look at the various topics starting here http://smartbear.com/support/viewarticle/12449/.  While recording and depending upon TestComplete to map your objects is a good starting point, inevitably you'll run into situations (as you just did) where you will need to manually edit, update, change, delete, add, etc., NameMapping objects to your project in order to make it reliable.
  • Greetings,



    Well, forcing IE to a single iexplore.exe process is not required once we need to close a pop-up window.



    When a pop-up window is invoked, a new instance of the IEFrame object is created in the master iexplore.exe process (the one having index = 1). So we can use the IEFrame.Close() method to close it. To identify which instance of IEFrame corresponds to the pop-up window, we can use the combination of the following two attributes: WndClass="IEFrame" and WndCaption="The_Caption", where The_Caption is the actual caption of the pop-up window.



    Attached is a project that shows how this can be performed with keyword tests and scripts.