How to close the window that are dynamic

Hi,

I have a scenario where bot will close the window .
For first loop the bot will close 2 windows where i hva egiven 2 close window activities to close…but again when the bot goes to second loop then only one window will be open so it has to close only 1 window…how do I make use of while condition here…
My bot is closing 1 window and again it wats for second window to close which is not opened.

Please help.

Hi @Bhagyashree_S

Only for first iteration the two windows will open and after for all other iterations the one window will open.

If yes, you can do it by creating Count variable with Integer datatype and initialize as 1. Inside loop take an If condition to check the count of Count Variable Ex: Count = 1 Inside then block give the two close window activities to check the two windows. In else block give the one close window activities to close one window. After that use assign activity to increment the Count.
Count = Count+1.

Hope it helps!!

Hi @Bhagyashree_S

If it’s fixed then you can
Set up a counter variable: Initialize a counter variable and use IF activity
IF: Counter=1 //Close both window
Else: Close one window

Hope it will helps you to understand :slight_smile:
Cheers!!

Hi @Bhagyashree_S

You can use Check App State before close the window so the close activity will runs only if window is present

Cheers

How do I make use of while loop instead of if

You are already using while or any other loop activity or you want to use while activity for this condition.

Provide more information then we can understand and provide the better solution @Bhagyashree_S

I want to use while activity forr this

@Bhagyashree_S

Implement below Logic