Click Trigger Activity not working for 2nd iteration

I am using monitor events and click trigger, my understanding is that unless the click trigger activity takes place the sequence below will not be executed- please correct me if I am wrong.

My scenario: I have an excel sheet with 3 rows for which I am reading the sheet and iterating for all row values, My bot should open browser, enter username and password and then once the homepage is displayed, it should click ‘Inbox’ (click trigger)in the homepage and sign out and close tab.
Issue is that for first iteration it works fine but once first iteration is completed the bot simply stops without any error.
Please help.

Edit: Now it’s not even working for first iteration, doubt-whatever we put in click trigger activity, does it need to be clicked manually or bot will click it?


Manually you have to trigger.


Thanks - but why is that it works only for 1 iteration and does not continue for the second iteration, attaching demo workflow, where I need to login and logout of gmail for 3 row items in an excel sheet.ClickTriggerSample.xaml (17.8 KB)


You may want to confirm on your second iteration that the click trigger selector hasn’t changed.

The selector on your click trigger is the following:

Looking at it briefly, I would guess the parentid is value is changing each iteration. If so, you’ll have to find a different way to define the selector that does not change.


1 Like

Thanks for your reply,

@martinw3 I checked upon the selector thing and tried to fix it, I developed another simple flow, it just opens and closed notepad for total 3 iterations.
In the for each loop, there are activities before the click trigger events, concern is that after the first iteration, bot doesn’t even get inside the loop though there are transactions.
Please if you can share an example where click trigger is used and the bot iterates through all the transactions successfully.
Book1.xlsx (8.4 KB) Main.xaml (18.3 KB)

@Ananthu @Manjuts90 @Lahiru.Fernando Please can you throw some light on this, will be very helpful.

Hello @Faraz_Subhani

Seems like there is something wrong with the even that you created. It doesn’t seems to be working.

However, I edited the same file. Added a click trigger to the body of the notepad. So once it opens, click on the body of the notepad and it will start typing the value, closing and reopeing again inside the loop.

This works fine over here. I have also used trigger activities for excel to get the focus to excel files as excel app scope mostly opens it in the background which prevents performing few scenarios like use of hot keys.

Check this out…
Main(1).xaml (17.3 KB)


Thanks for your response.
I am still stuck with same thing, on my end the file which you edited doesn’t even work for the first iteration.
I believe after opening Notepad, your are simply clicking anywhere in the notepad as trigger activity and after that it should type the first value, close notepad and again iterate through the second value.
I’m really confused with this, this thing is not working here and I am stuck up with the same scenario in an actual project from past 3 days.
I am unable to use click trigger for a simple demo notepad application even.

Hey @Faraz_Subhani

Yes… The trigger is a click on the body of the notepad… Wonder why it doesn’t work in yours…

I have one point… Try checking the selector I have is valid in your machine? May be that is causing the problem… Are you using windows 10? or a different version?


@Lahiru.Fernando I am using Windows 10, I don’t think issue is there with trigger activity, in the attached workflow I did not use trigger activity , simply i opening notepad ->Typing and closing for all row items.
There is no trigger activity, Even this doesn’t seem to work after 1st iteration, it’s so simple thing, I’m not getting why isn’t it going for second iteration.Main.xaml (14.4 KB)


What are the activities you are using inside your open application?

It seems I’m getting missing or invalid activity error. These are simple click and type into activities right?

I think there is something wrong with the versions you are using… May I know what versions of activities do you have for dependencies and what version of Studio are you using?


Hey @Lahiru.Fernando
I am using community 2019.8. The activities inside open application are simply type into(typing the value of row(0)), then closing the excel sheet.
I 'm really confused now, it works fine for first iteration, then for second iteration it just stops-there is no trigger activity being used.
It’s just not opening the application for second iteration-No idea why
Even though in debug mode while I’m stepping into,for the second iteration bot is skipping open application part and jumping to the activities after the open application, even if there is open browser it’s behaving same was and skipping that too for second iteration.

Hey @Faraz_Subhani

That’s pretty weird… I dont understand why its skipping the activities… in the debug mode does the activity its stuck at turns out in red color after 30 seconds? If that turns out as red, can you share the error that its showing in the locale panel under exception variables.

Can you also try upgrading your dependencies in the project to see whether it works? You can get to package manager and upgrade there if they have any latest updates available


The exception is time out exception which is coming for the activity when I am trying to close the notepad for 2nd iteration, but it doesn’t even opens notepad->performs other activities and directly jumps to latter activities.
I have checked for dependency updates-All are up to date.
This has become very weird-Basically If I’m having an open application/Open Browser inside a for each loop, it is working for 1st iteration and for second it does not.
If I remove the open application/browser from loop, it works fine for all the row items in datatable.
I have no clue now, does it work for you?

Hey @Faraz_Subhani

Yeah… it should work. And in the xaml file which I shared with you above, I actually have the open application inside the for each row loop. It worked fine for me.

Oh by the way have you tried resetting the selectors of the file I sent to suit yours… remove the trigger and see whether it works… it worked nicely on mine. So without the trigger it for you


@Lahiru.Fernando So, now If I am having only open notepad application and upon opening I am typing the row items, it works fine for all the 3 row items, 3 different instances of Notepads are opened as I am not closing it, as soon as I introduce, on element appear in order to close the application it starts failing from 2nd iteration, this should probably happen because of selector issues but selectors seem to be fine.
I tried your workflow as well, same it fails for 2nd iteration.
Below is my selector for on element appear for Save/don’t save

Can I see the error it throws once you introduce the On element appear activity?

Additionally, in On Element Appear activity, have you set the repeat forever property to False?


Holyyyyy, Man turning repeat forever to false was the fix, not only for On Element Appear but even for Monitor events. Thanks a lot:-)
.Please may I know what is the exact usage of Repeat forever?
Thanks again.

1 Like

Hahaha yeah… just guessed that could be the problem because you said it all started after introducing the on element appear… haha. Anyway glad to know it fixed the problem…

Well it is mostly used when you want to repeat a particular set of activities each time an element start appearing on screen… if it’s a one time run, we simply make it false :slightly_smiling_face:


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.