Can we use Close Window inside Catch block to catch error?

If yes, how can we create variables using Windows? I am getting an error.
The following overload groups are configured: Find Window, Use Windows. only one overload group should have its argument configure


d.

@Samraat_Maharjan

Use Attach Window activity and capture the window which you need to close
Then inside the Attach window you can place Close window activity as below

image

Hope this may help you

Thanks,
Srini

Thank you for your reply. Can I use this to catch errors? I have used an element exists to catch errors in a web browsers. After catching that error I want to close my window and restart the process again by opening the browser. Will it work?
And lastly, Do I need to pass any variable inside Use Window?

The problem with my automation/bot is It can get errors at any stage and when there is an error generally there’s an administrative error. Do I need to attach that particular error page (while indicating window on screen) or any can I attach any page in that specific browser?
And Do I need to give output value?

@Samraat_Maharjan

So, you can use Element Exist to get the Error message and use the If condition, If you get element appears then use Attach window and In Attach Window you need to identify the window when you get the erorr, It usually take the title of the page

You can use Try Catch also and if the action is only to close the window, then I believe there is no requirement of Variables to declare

Thanks,
Srini

Once again Thank You for your reply. Do I need to indicate the same error page in attach window as well as in close window activity?

@Samraat_Maharjan

Not required only on the Attachwindow is enough, close window will close that window

If this solves your issue, Please mark as solution so that others will benefit on this

Thanks,
Srini

Okay, I will do that if it works. Last final question. Do I need to pass variable in attach and close window?

@Samraat_Maharjan
Not required

Thanks,
Srini