Forum Discussion

romanmfs's avatar
Frequent Contributor
6 years ago

pop up window how to ignore


I am having an issue and asking for help :(

I have keyword testcases running on a particular website with no problem.

However business implemented redcently a pop up that randomly shows up on a home page which blocks the page and brakes the test cases.


The only way to get rid of that is by clicking "no thanks" on a pop up.


Is there a way i can record a keyword test case that lets says "if" the pop up present- hit "no thank you "else"- ignore.



8 Replies

    • romanmfs's avatar
      Frequent Contributor

      Thank you! 

      So here is what I did. 

      I recorded the test and clicked on the "no thank you button" to get the object name.

      then I created a script and added it to the keyword test right before the moment when the pop up sometimes pop ups.


      here is the script:


      function Test()
      if (Object.Exists) {
      else {
      Log.Message("Popup Does Not Exist.")
      } }


      What could be wrong?

      it runs fine when the pop up is not there and the report gives me a message that pop up does not exist, but the times when it does pops up TC does not click on no thank you button.

  • AlexKaras's avatar
    Champion Level 3



    If you know when this pop-up can be displayed, than Carson's suggestion is the way to go.

    If the pop-up can be displayed unpredictably (e.g. by timer, some randomizer, etc.) then you may consider one of the OnXXX events of TestComplete (e.g. OnUnexpectedWindow, OnOverlappedWindow, etc., the exact event to use depends on the design and behaviour of the tested web page.) and implement the similar code that will check if pop-up is displayed and close it.