How to handle random popup

This is the approach I am thinking of, but problem is it will take lots of time to put exception handling for each activity.

That is expected popups, if we ignore those popup it will affect user’s session.

Yes. It will be too complicated to use lots of try-catches.

Aside Parallel it seems it makes sense to create an activity called PopupScope. Before going to the next instruction within PopupScope it will permanently check if we have a popup on the screen plus it will contain instruvtions on how to handle the popup (click ok, click cancel, etc).

@badita - Do you mean to create custom activity “PopupScope”? OR we can use any existing activity like “Element scope”?

@uipath to create :slight_smile:

ok… Thanks :slight_smile:

Have you tried using continue on error?

many TryCatch, not really, I think more like, since I had the same synthom when somebody else connect to the webpage to download invoices, I was downloading an invoice lets say IP0001, then on the P1002 the pop up appears, what I did is a try catch. try to download invoice P1002 and if there’s any error click the popup and “end” the process, now, outside the try catch What I had it was an state machine to read in a config file which invoices the robot was able to download and put a log on a certain row, and then since the process stoped on P1002 this row would not have the log, so it will start from there again.

What do you think, I guess I can send you the XAML for your reference if you have doubts on how to implement this. :slight_smile:

Continue on error for every element is also not a good option. Because If flow will continue on error then it will not do work what I indent to do.

Thanks @beesheep I understood your scenario and I’ve implemented try catch at few places, but my situation is popup randomly comes in between the activity I am doing hundreds of activity

My situation can be solved if I do below

  • If i create one workflow to close popup if its available and include between every activity.


  • Inovke Popup close workflow
  • Activity 1. e.g. Click on element
  • Invoke Polpup Close Workflow
  • Activity 2. Type text
  • Invoke Popup Close Workflow
  • Activity N…

first add “image exists” then assign a variable to it and then use decision flow activity, in “image exists” give the image of popup, and in the decision flow , in true part use click activity (to close the popup). try this and it should work. :slight_smile:

@yashvardhan_singh - This approach can work if popup 's pattern is fixed, in my case popup can come in between of screen any time.

Hi @badita,

Would you know if @uipath is planning to implement the “PopupScope” activity you mentioned here?

1 Like

I think the Get Active Window activity should work for this use case. If a timeout exception occurs in try block due to a pop up, you can use Get Active Window activity in the catch block to get the pop up window and pass a Alt+F4 hotkey to close it. Let us know if it worked.


Hello, “alt F4” is not working for my application,

but I want use the "Window.Close ()" for closing unknown popup, let me know how to do in uipath

I was trying to automate using flipkart. When we land on home page of flipkart for first time, we sometimes get popup and sometimes we dont. As per below thread i used element exists and I have put if condition and if popup comes I close pop up and for else condition my rest of the flow follows is this correct approach as Im newbie to UIpath

hey,have you solved this one??? I am also facing the same trouble @ChinnapuReddy

Hi @amithvs

EDIT. I think my answer was not on point. If you’d like to execute a command like that:
you can do so with Invoke Code activity:


The new feature of Global Exception Handler might be your answer. It was introduced in the 2018.4 Community Edition. You can find more information here:

and here:


will check this and let you know. Thanx.